Re: Need help in passing a -c command argument to the interactive shell.

2009-07-29 Thread Duncan Booth
Bill bsag...@gmail.com wrote:

 On my windows box I type = c:\xpython -c import re
 
 The result is = c:\x
 
 In other words, the Python interactive shell doesn't even open. What
 am I doing wrong?
 
 I did RTFM at http://www.python.org/doc/1.5.2p2/tut/node4.html on
 argument passing, but to no avail.

Why are you reading documentation for Python 1.5? There have been just a 
few releases since then.

Try reading http://docs.python.org/using/cmdline.html instead, specifically 
the part about the -i command line option. Or you could just try python 
-? at a command prompt.

-- 
Duncan Booth http://kupuguy.blogspot.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Need help in passing a -c command argument to the interactive shell.

2009-07-28 Thread Philip Semanchuk


On Jul 28, 2009, at 4:16 PM, Bill wrote:


On my windows box I type = c:\xpython -c import re

The result is = c:\x

In other words, the Python interactive shell doesn't even open. What
am I doing wrong?


Nothing! =) The -c option tells Python to execute the commands in the  
quotes as a Python program. It's as if you wrote a Python program that  
contained only import re and then executed that program.


If you want to run the Python interpreter interactively, just type  
python (no quotes) at the command prompt and hit enter.




I did RTFM at http://www.python.org/doc/1.5.2p2/tut/node4.html on
argument passing, but to no avail.


Yikes, that's the documentation for Python 1.5.2 which is nine years  
old! If that's the version you're running, then it's appropriate to  
read that documentation, but that's probably not the case.


python --version (again, no quotes) should tell you what version  
you're running.


HTH
Philip

--
http://mail.python.org/mailman/listinfo/python-list


Re: Need help in passing a -c command argument to the interactive shell.

2009-07-28 Thread Mark Lawrence

Bill wrote:

On my windows box I type = c:\xpython -c import re

The result is = c:\x

In other words, the Python interactive shell doesn't even open. What
am I doing wrong?

I did RTFM at http://www.python.org/doc/1.5.2p2/tut/node4.html on
argument passing, but to no avail.
You've told python to run the command import re which it's happily 
done before exiting.  Simply type python, then at the prompt (default 
) type whatever commands you wish, e.g.


c:\Users\Mark\python\regexpython
Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit 
(Intel)] on

win32
Type help, copyright, credits or license for more information.
 import re
 help(re.compile)
Help on function compile in module re:

compile(pattern, flags=0)
Compile a regular expression pattern, returning a pattern object.



--
Kindest regards.

Mark Lawrence.

--
http://mail.python.org/mailman/listinfo/python-list