How to call script in interative status

Anna revanna at mn.rr.com
Thu Feb 27 00:56:07 EST 2003


On Wed, 26 Feb 2003 19:03:03 +0000, Fu Chen wrote:

> Hi!
> 
> I use python under windows2k.
> Uptonow i only call script by
> python script.py arg1 arg2
> 
> My question is can we call a script under the interative status ( >>> )
> and how to do ? it seems possible to import a script and call its function
> like script.func, but how to run the segment marked by name == '__MAIN__'
> ?

If you're asking what I *think* you're asking, using, eg IDLE, I use the
File->Open Menu to open the file where my script is stored. This opens a
new window showing my script. On that window, I click on the Edit Menu
which gives me options, including "RUN SCRIPT". (In Windows, if I
remember, it's simply F5. Here at home on my Linux box(Mandrake 9.0 running
IDLE 0.8) it appears to be CTRL-F5)

Just remember that if you import any modules, you need to actually reload
them using reload(Module) or you end up with the same stored version of the
module, instead of the updated version.(It's amazing how many times I
corrected an error, only to finally realize that I hadn't reloaded the
damn module so it really wasn't going to show whether it was fixed or
not... )

HTH

Anna




More information about the Python-list mailing list