pythonwin woes
Mark Hammond
mhammond at skippinet.com.au
Fri Jan 30 19:09:53 EST 2004
oliver wrote:
> Hi,
>
> I am trying my hands on the latest verion of pythonwin extension with
> python 2.3.3 , and run into *semi-fatal* problem: the run command
> ignores the modifications I made to the source code, and *always*
> show me results given by that outdated source: it feels like it just
> use that cached .pyc!!!
>
> I wonder if the other pythonwin users had experienced the same
> problem, or did I miss anything here. There is no such problem in IDLE
> though.
The difference will be that Pythonwin runs all programs "in process".
When you run a program for the second time, all of the 'import'
statements are still using the same module they imported before. The
solution is generally to *reload* the modules you change, before you run
the main script. Pressing Ctrl+I will do that for you - it will reload
the module if it was previously imported. After doing that, your main
script should see the new modules.
IDLE runs all programs in a new, external Python process, so never sees
this issue. In lots of ways, I like the way Pythonwin does it - keeping
that state around can be very useful - eg, after the program has
terminated, you can still see the objects etc.
Mark.
More information about the Python-list
mailing list