Re: [Tutor] sys.argv[1: ] help

2005-02-28 Thread Alan Gauld
> As an added bonus, you can also create a system environment variable > called PATHEXT and set it to .py and you won't even have to type the .py Well, well, well, you live and learn! :-) Thanks for that neat tip. Alan G. ___ Tutor maillist - Tutor@

Re: [Tutor] sys.argv[1: ] help

2005-02-28 Thread Richard gelling
pyc While you're at it, you should also check the assoc/ftype for .pyw as .pyw=Python.NoConFile Python.NoConFile="C:\Python24\pythonw.exe" "%1" %* Good luck, Jeff -Original Message- From: Richard gelling [mailto:[EMAIL PROTECTED] Sent: Sunday, February 27, 2005

RE: [Tutor] sys.argv[1: ] help

2005-02-28 Thread Smith, Jeff
oConFile Python.NoConFile="C:\Python24\pythonw.exe" "%1" %* Good luck, Jeff -Original Message- From: Richard gelling [mailto:[EMAIL PROTECTED] Sent: Sunday, February 27, 2005 1:41 PM To: tutor@python.org Subject: Re: [Tutor] sys.argv[1: ] help Hi, It is actually as

Re: [Tutor] sys.argv[1: ] help

2005-02-27 Thread Jeff Shannon
On Sun, 27 Feb 2005 17:55:54 +, Richard gelling <[EMAIL PROTECTED]> wrote: > > No What I get if I was to type in > ./arg1.py a b c > > All I get is > [] It sounds as though the command shell is not passing along the additional parameters. Try opening Windows Explorer, and go to the Folder

Re: [Tutor] sys.argv[1: ] help

2005-02-27 Thread Danny Yoo
> Add a file called 'test.cmd' in the same directory as your 'test.py' > program with the following content: > > ### > python test.cmd %* > ### Scratch that! *grin* Sorry, meant to write that the test.cmd should contain: ### python test.py %* ### Darn it, but I don't have a Windows box handy

Re: [Tutor] sys.argv[1: ] help

2005-02-27 Thread Danny Yoo
> >(I know I'm being a bit silly about asking about what looks like a > >simple email typo, but computer programming bugs are all-too-often > >about typos. *grin* > > Sorry for the late response, I tried all of the the suggestions, > including correcting my typo of print sys[1:] and tried print >

Re: [Tutor] sys.argv[1: ] help

2005-02-27 Thread Liam Clarke
Yeah, python.exe is the right one... bizarre... I'll have a poke at it when I get home from work. Sorry I haven't been more helpful. Cheers, Liam Clarke On Sun, 27 Feb 2005 18:57:30 +, Richard gelling <[EMAIL PROTECTED]> wrote: > > Hi, > > It is actually associated with just 'python', ch

Re: [Tutor] sys.argv[1: ] help

2005-02-27 Thread Richard gelling
Hi, It is actually associated with just 'python', changed it to associate with 'pythonw' and I got nothing on the same example not even the [], so I am assuming that 'python' is the correct one? Liam Clarke wrote: Yeah, right click on a .py and check if it's associated with pythonw or python.

Re: [Tutor] sys.argv[1: ] help

2005-02-27 Thread Richard gelling
Hi, It is actually associated with just 'python', changed it to associate with 'pythonw' and I got nothing on the same example not even the [], so I am assuming that 'python' is the correct one? Liam Clarke wrote: Yeah, right click on a .py and check if it's associated with pythonw or pyth

Re: [Tutor] sys.argv[1: ] help

2005-02-27 Thread Liam Clarke
Yeah, right click on a .py and check if it's associated with pythonw or python.exe GL, Liam Clarke On Sun, 27 Feb 2005 18:28:18 +, Richard gelling <[EMAIL PROTECTED]> wrote: > Hi, > Yes, I use both Wndows XP and Linux( at work ) . I left that in by > mistake I am actually just typing in >

Re: [Tutor] sys.argv[1: ] help

2005-02-27 Thread Richard gelling
Hi, Yes, I use both Wndows XP and Linux( at work ) . I left that in by mistake I am actually just typing in arg1,py a b c at the windows XP command prompt Sorry for the confusion. Liam Clarke wrote: Are you using XP still? I've never seen this before - ./arg1.py a b c But anyhoo, I tri

Re: [Tutor] sys.argv[1: ] help

2005-02-27 Thread Liam Clarke
Are you using XP still? I've never seen this before - > ./arg1.py a b c But anyhoo, I tried out just 'c:\python23\foo.py' as opposed to 'c:\python23\python foo.py' and while foo.py will run, it doesn't echo to the console, as on my machine running a .py file runs it through pythonw.exe - I'd

Re: [Tutor] sys.argv[1: ] help

2005-02-27 Thread Richard gelling
Hi, No What I get if I was to type in ./arg1.py a b c All I get is [] If i type at the command prompt python arg1.py a b c I get ['a','b','c'] as expected All the other programs and examples I have typed in work fine just by typing in the file name, I don't have to preced the file name with pyt

Re: [Tutor] sys.argv[1: ] help

2005-02-27 Thread Nick Lunt
Richard, if you try to print sys.argv[1:] when sys.argv only contain sys.argv[0] then you are bound to get an empty list returned, [] . Im not sure I understand the problem you think you've got but here's what happens with sys.argv for me, and it's correct. [argl.py] $ cat argl.py #!/usr/bin/py

Re: [Tutor] sys.argv[1: ] help

2005-02-27 Thread Richard gelling
Danny Yoo wrote: I am reading ' Learning Python second edition' by Mark Lutz and David Ascher, and I trying the code examples as I go along. However I am having a problem with the following, which I don't seem to be able to resolve :- # test.py import sys print sys[ 1: ] This I believe

Re: [Tutor] sys.argv[1: ] help

2005-02-25 Thread Danny Yoo
> > I am reading ' Learning Python second edition' by Mark Lutz and David > > Ascher, and I trying the code examples as I go along. However I am > > having a problem with the following, which I don't seem to be able to > > resolve :- > > # test.py > > import sys > > > > print sys[ 1: ] > > > > T

Re: [Tutor] sys.argv[1: ] help

2005-02-25 Thread Liam Clarke
Remember computers count from 0, so sys[1] is the 2nd argument, sys[0] is always the filename. On Fri, 25 Feb 2005 22:33:50 -0500, Jay Loden <[EMAIL PROTECTED]> wrote: > Should be: > > import sys > > def main(): > '''prints out the first command line argument''' > print sys.argv[1] > > main

Re: [Tutor] sys.argv[1: ] help

2005-02-25 Thread Jay Loden
Should be: import sys def main(): '''prints out the first command line argument''' print sys.argv[1] main() On Friday 25 February 2005 04:35 pm, Richard gelling wrote: > Hi, > > I am reading ' Learning Python second edition' by Mark Lutz and David > Ascher, and I trying the code examples

[Tutor] sys.argv[1: ] help

2005-02-25 Thread Richard gelling
Hi, I am reading ' Learning Python second edition' by Mark Lutz and David Ascher, and I trying the code examples as I go along. However I am having a problem with the following, which I don't seem to be able to resolve :- # test.py import sys print sys[ 1: ] This I believe is supposed to prin