trouble with reload
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Fri Aug 14 14:03:27 EDT 2009
On Fri, 14 Aug 2009 13:14:16 -0400, Colin J. Williams wrote:
> Steven D'Aprano wrote:
>> On Fri, 14 Aug 2009 09:23:17 -0400, Colin J. Williams wrote:
>>
>>> It's typically a user module that needs to be reloaded.
>>
>> What's a user module?
> A module written by a user, as distinguished from a libary
You mean an end-user of the application? Or you mean the application
programmer?
I'm not sure there is any difference between "user modules" and "library
modules" apart from what they do.
Perhaps it would help if you could explain the circumstances of when you
would reload a module. During application development, for an incremental
edit/reload/test cycle? Or while the completed application is being
executed?
>>> Is there some other way of ensuring that any import goes to
>>> moduleName.py, instead of moduleName.pyc?
>>
>> Delete moduleName.pyc.
>>
>> Make sure the .pyc file doesn't exist in the first place.
>>
>> Make sure the last modification date of the .py file is newer than the
>> modification date of the .pyc file.
>
> That's easier said than done, when one is working with an IDE. The
> cached .pyc file might be different from that in the file.
If the IDE is getting in your way, then don't use it.
Or if you tell us what IDE you're using, and precisely what it is doing,
somebody can tell you how to defeat the IDE's cache.
(That won't be me -- I don't use IDEs.)
Or perhaps you're entire approach is wrong, and you shouldn't be using
reload() at all. Don't know.
--
Steven
More information about the Python-list
mailing list