Python Can Find A Module....and Then It Can't
I am finally going full steam into Python, but for some reason I have an issue where Python can find a module in the interactive CLI and then it can't when I write a script. The mo
Solution 1:
In the traceback, I see that you named your file mysql.py
. Therefore, when you try to import something from mysql.py
, the interpreter looks for it in your own script, not the "actual" module. Instead of casting a wider net, it immediately gives up. To fix this, rename your script to something that doesn't mask any module names.
Solution 2:
You have a mysql
something or other either in your home directory, or in your new directory. It might be a .py
file or perhaps the actual package (in the wrong place ;). Fix that and your problem should go away.
Post a Comment for "Python Can Find A Module....and Then It Can't"