"Unused import statement" error, code disappears if I resolve it.
已回答
I've read the other threads on this particular issue I am experiencing, but I can't identify with the problems and hence I started a new one.
Optimizing imports as suggested by others make the code disappear.
Does anyone have a fix for this?
请先登录再写评论。
Hi Ry4n L3e! Could you provide an example please? Optimize import should remove all unused imports - it's the default behaviour.
My apologies!
I have numpy installed by means of Preferences > Project Interpreter > "+" > numpy. Numpy now shows as version 1.13.0rc2 (Latest Version).
When I type in "import", the recommendations show "import" and "__import__ (name, globals.....)". Using the autocomplete, "import" appears in orange fonts. And I proceed to type in "bumpy", which triggers the autocomplete too. However as soon as I type it in, the entire line gets greyed out, triggering the error in my title.
I hope I have described it sufficiently for troubleshooting.
Thanks a lot!
Hi,
i have the same problem like Ry4n L3e.
He describes it well, here are some screenshots.
I try to import the "random" lib:
Thank you so much for help,
Luki
Not sure what I did right/wrong. I simply updated and continued coding as if there's no error. When the imported package is called for, it appears and is in use. When I import additional packages but did not use it, they remained greyed out. Might be a feature of PyCharm to help build faster.
Yeap, if the import is not used (e.g. imported object was not called) then PyCharm is going to mark it as unused and grey out. It's a feature.