Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove bare except usages #3137

Open
arunppsg opened this issue Dec 13, 2022 · 8 comments · May be fixed by #4338
Open

Remove bare except usages #3137

arunppsg opened this issue Dec 13, 2022 · 8 comments · May be fixed by #4338
Labels
Good First Contribution maintenance Issues related to code maintenance

Comments

@arunppsg
Copy link
Contributor

arunppsg commented Dec 13, 2022

Some parts of the code uses bare except clauses which should be replaced with valid exception clauses. To find the usages of bare except, edit setup.cfg and remove the flake8 ignore code line for E722 and run ./scripts/flake8_for_ci.sh. This will raise flake8 errors at the lines of code where bare excepts are used.

@arunppsg arunppsg changed the title Remove bare except clauses Remove bare except usages Dec 13, 2022
@BalajiAI
Copy link
Contributor

So one needs to find all the lines where bare excepts are used using the above mentioned script and delete it, Am I right?
What's wrong with bare except?

@BalajiAI
Copy link
Contributor

BalajiAI commented Dec 13, 2022

I would like to work on this issue!

@arunppsg
Copy link
Contributor Author

Here is an example of bare exception:

try:
     import xyz
except:
     pass

Eliminating bare except is not deleting those lines, like replacing the above line with only import xyz. It is writing the clause for the bare exception, like:

try:
    import xyz
except ModuleNotFoundError:
    pass

On what is wrong with bare except, see this SO answer and PEP-8.

@arunppsg arunppsg added the maintenance Issues related to code maintenance label Dec 22, 2022
@BalajiAI
Copy link
Contributor

On what is wrong with bare except, see this SO answer and PEP-8.

Thank you very much!

@BalajiAI
Copy link
Contributor

image
As you can see above, I've removed the E722 from flake8 ignore code.

image
But it didn't raise any errors. So there is no bare excepts or I might have a problem on my side.

@anirudhprabhakaran3
Copy link

Mind if i have a crack at it?

@AJ0070
Copy link

AJ0070 commented Jan 18, 2025

Hey @arunppsg If this issue is still open I would like to work on it!

@Yashasvi692
Copy link

@arunppsg I would love to work on this issue if it is still available.

@Yashasvi692 Yashasvi692 linked a pull request Mar 7, 2025 that will close this issue
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Contribution maintenance Issues related to code maintenance
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy