Two Simple Qs:

Sheila King sheila at spamcop.net
Tue Jul 17 15:33:43 EDT 2001


On 17 Jul 2001 11:19:51 -0700, newgene at bigfoot.com (newgene) wrote in
comp.lang.python in article
<a50631f6.0107171019.74fb42a5 at posting.google.com>:

:I am quite new to python. I have 2 simple questions:
:
:1. How can I run a simply Python script under IDLE directly? I wrote a
:start.py to do some routine work, like importing some medules and
:adding my working path into sys.path, before I start to work. This
:script is just like a macro or batch file under DOS. Now I have to
:open this file and then run it. I hope python have a statement can run
:it directly( maybe like 'run start.py').

To run a script from within IDLE:
1. Go to the File menu and choose "Open". Browse to your script and
select it. It should open in a new window.
2. In this new window, go to the Edit menu and select "Run Script". The
output of your script will appear in the Interactive Python Shell (the
original IDLE window that you had open).

:2. When I made some modification of my own module after I import this
:module,python can not recognized the modified module even I import it
:again. It raised the same error msg, but gave me the error line
:actually I have corrected, that is , it run as the old module but
:display the error from the newer module file. I have to restart python
:environment and import again, then my module run correctly. Is this a
:bug? And how to resolve it?

Try this:

>>> del modulename
>>> import modulename

Hopefully that will help.

--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/




More information about the Python-list mailing list