[BangPypers] unable to figure out the ways to run a module

Gopal Ghosh gopalmessages at gmail.com
Mon Aug 25 12:18:36 CEST 2008


I created a script – myscript.py and saved it at c:\myscript.py
*******
myscript.py contains the following commands
a=1000
2**8
print 'hello world'
raw_input( ) # what this command does???
******
now I tried to call the script from
IDLE
>>>myscript.py
(not working from IDLE) got the error
Traceback (most recent call last):
  File "<pyshell#30>", line 1, in <module>
    power.py
NameError: name 'power' is not defined
RUN
c:\myscript.py
(working from RUN)
Python CLI – called by typing python at run prompt
>>>myscript.py
 (not working from Python CLI) again got the same error as in IDLE
******************************************************
now I tried to run the script in a different way
IDLE
>>>myscript.py > saveit.txt
(not working from IDLE) got the following error
Traceback (most recent call last):
  File "<pyshell#29>", line 1, in <module>
    power.py > saveit.txt
NameError: name 'power' is not defined
RUN
c:\myscript.py
(working from RUN – but don't know where to locate saveit.txt)
Python CLI – called by typing python at run prompt
>>>myscript.py
 (not working from Python CLI) got the same eror as in IDLE
******************************************************


More information about the BangPypers mailing list