unused import statement ... is wrong?
Sometimes PyCharm 3.0.1 marks an import statement (like 'import os') as unused, but if I comment it out, the program doesn't run, saying 'NameError: name 'os' is not defined'.
What might be happening?
Question is not answered.
Has been 1 times resubmitted ( last:
Also asked by
Please, specify the case of using import.
Also you can suppress inspection: use "Alt+Enter" and go to Optimize import -> suppress for statement (take a look at web-help
Ok, I've narrowed it down; it's something to do with a namespace collision, but it really shouldn't have this problem anyway, I think.
It's very common to do "from pylab import *" – I know that's Bad, but the thing is, this has never caused issues until PyCharm 3.0.1 for me. (And
claims that this is the CORRECT way to import pylab.)
Here's a minimal program that shows the problem:
from pylab import *
For that code, pycharm claims that "import os" is unused, but if you comment it out, os is not defined.
go to parent
Unused imports optimization is not quite right
Cannot install package 'beautifulsoup4' in Python 3.4
Build #182 (Apr/23/2015 5:01PM)