pre-edit stuff persists in a reloaded a module
Friedrich Rentsch
anthra.norell at bluewin.ch
Sat Oct 5 07:48:35 EDT 2019
Hi all,
Python 2.7. I habitually work interactively in an Idle window.
Occasionally I correct code, reload and find that edits fail to load. I
understand that reloading is not guaranteed to reload everything, but I
don't understand the exact mechanism and would appreciate some
illumination. Right now I am totally bewildered, having deleted and
garbage collected a module and an object, reloaded the module and remade
the object and when I inspect the corrected source (inspect.getsource
(Object.run)) I see the uncorrected source, which isn't even on the disk
anymore. The command 'reload' correctly displays the name of the source,
ending '.py', indicating that it recognizes the source being newer than
the compile ending '.pyc'. After the reload, the pyc-file is newer,
indicating that it has been recompiled. But the runtime error persist.
So the recompile must have used the uncorrected old code. I could kill
python with signal 15, but would prefer a targeted purge that doesn't
wipe clean my Idle workbench. (I know I should upgrade to version 3. I
will as soon as I get around to it. Hopefully that will fix the problem.)
Thanks for comments
Frederic
More information about the Python-list
mailing list