Python modules not updating after restarting main module
I recently went back to a project that was supposed to stop for about 6 months, and after reinstalling my operating system and returning to it, I have all sorts of crazy stuff. I tried to install the exact same version (2.6) of python that I used before.
It started when I asked me a strange tkinter error that I had no problems with before, the program is relatively simple and 2 or 3 errors that remained when I left I documented and had no interface to it.
Things got even weirder when the same error kept showing up even after I removed the offending section of code. In fact, the traceback pointed to a line that didn't even exist in the module it was referencing, for example: line 262 when the module had only 200 lines.
After running a completely new file for the main module and copy / paste, it finally found out that the offending code was lost and I stopped getting the error only to find that any updates to the code I made in the other module were not showing when I restarted the program through the shell. (I didn't forget to save some money.) After that happened, of course, there was an old interface error, just in a different section of code that worked earlier.
In fact, if I go back to the files I had six months ago, the program works fine. However, as soon as I change something in the main module, an interface error is returned.
Here's the original error:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python26\lib\lib-tk\Tkinter.py", line 1410, in __call__
return self.func(*args)
File "C:\PyStuff\interface.py", line 202, in dispOne
__main__.top.destroy()
File "C:\Python26\lib\lib-tk\Tkinter.py", line 1938, in destroy
self.tk.call('destroy', self._w)
TclError: can't invoke "destroy" command: application has been destroyed
I am guessing there is something else going on here besides my own bad programming. Does anyone have any ideas?
Edit: I think I read something about it being a bad idea to run Tkinter programs through the IDLE shell, and at least it seems that the TclError disappeared if I instead run the main module by double clicking on it .pyc. Perhaps my problems were just a combination of what plus the tag / PYTHONPATH problems mentioned below by Chris Utley and Vlad?
a source to share
I had something similar. The reason for my problems was that my version control (hg) software was setting the date of the files to a date in the past. Because of this, python decided to use previously generated .pyc files that had new timestamps.
The solution was to remove all .pyc files before testing the code.
a source to share