A mistake which almost went me mad
Steven D'Aprano
steve at pearwood.info
Thu Mar 3 07:57:00 EST 2016
On Thu, 3 Mar 2016 09:21 pm, ast wrote:
> Hello
>
> This has to be told
>
> I created a file pickle.py in order to test some files
> read/write with objects and put it in a directory
> which is on my python path.
[...]
> I uninstalled python34 and reinstalled it, same problem
> I uninstalled python34 and instaled 3.5, same problem
And now you have learned a very important lesson:
Do not waste your time uninstalling and reinstalling Python until everything
else has failed.
> This module is probably used by various python programs,
> IDLE, pip ...
>
> Instead of reading official pickle, python read my file ...
Correct.
To diagnose these sorts of problems, start by opening your operating
system's command interpreter shell (PowerShell, command.com, com.exe,
terminal, or whatever it is called in your OS), and launch IDLE from the
shell. If something is broken, you will see the error message.
This is on Linux, but it will work the same way under Windows:
[steve at ando ~]$ touch time.py # Accidentally shadow the module
[steve at ando ~]$ idle # you may need to give the full path
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python2.7/idlelib/run.py", line 7, in <module>
import threading
File "/usr/local/lib/python2.7/threading.py", line 13, in <module>
from time import time as _time, sleep as _sleep
ImportError: cannot import name time
This tells you that there is a problem with the module time.py.
It is much easier to debug problems when you can see the error messages!
--
Steven
More information about the Python-list
mailing list