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

ExperimentDirectory.remove_all() removes none #2

Open
cclauss opened this issue Nov 30, 2018 · 0 comments
Open

ExperimentDirectory.remove_all() removes none #2

cclauss opened this issue Nov 30, 2018 · 0 comments

Comments

@cclauss
Copy link

cclauss commented Nov 30, 2018

This line throws an NameError on every file found in the line above so the expected os.remove() never happens. The loop is placing filepaths into the variable c but the os.remove() is attempting to delete filepath f which is an undefined name which raises NameError which is swept under the rug by the bare exception. PEP8 and other sources are quite articulate why bare exceptions should be avoided and this is a classic example.

flake8 testing of https://github.com/CSAILVision/NetDissect-Lite on Python 3.7.1

$ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics

./visualize/expdir.py:81:27: F821 undefined name 'f'
                os.remove(f)
                          ^
1     F821 undefined name 'f'
1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant