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

abhinav sarkar abhinav.sarkar at gmail.com
Mon Aug 25 12:29:09 CEST 2008


On Mon, Aug 25, 2008 at 3:48 PM, Gopal Ghosh <gopalmessages at gmail.com>wrote:

> 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
> ******************************************************
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>

Hi
I think you are using an older version of python which doesn't support the
exponential operation (2**8). The code provided by you work in my python
prompt.

raw_input() takes a raw string as input from the console. more info at
http://docs.python.org/lib/built-in-funcs.html#l2h-59

Cheers

-- 
Abhinav Sarkar
Fair Isaac India

Mobile:+91-9731596137
Office: +91-8041371605

Web: http://claimid.com/abhin4v
Twitter: http://twitter.com/abhin4v
---------
The world is a book, those who do not travel read only one page.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/bangpypers/attachments/20080825/2ba69f90/attachment.htm>


More information about the BangPypers mailing list