sys.argv in Python 2.0 does not work? 
Author Message
 sys.argv in Python 2.0 does not work?

This seems really stupid. I just installed python 2.0 (after using python
1.5.2). Now a simple program like foo.py:

        import sys
        print sys.argv

only prints the list with one argument, the program name, when invoked on
WindowsNT 4.0 as follows:

Quote:
> foo.py abcdef

['g:\\mydir\\foo.py']

However, if invoked via python interpreter it does the right thing:

Quote:
> python foo.py abcdef

['foo.py', 'abcdef']

Is this something with python 2.0 or with my installation?

Also, any reason why in the first case the full path is in sys.argv[0] and in
the second case just the basename?

Thanks.



Sun, 11 May 2003 15:48:49 GMT  
 sys.argv in Python 2.0 does not work?

Quote:

>This seems really stupid. I just installed python 2.0 (after using python
>1.5.2). Now a simple program like foo.py:

>    import sys
>    print sys.argv

>only prints the list with one argument, the program name, when invoked on
>WindowsNT 4.0 as follows:

>> foo.py abcdef
>['g:\\mydir\\foo.py']

The whatsis that links extensions to programs isn't passing the
arguments.  I don't have access to NT these days, so I can't provide any
more assistance, but if you're familiar with NT, you should be able to
figure it out.  This may also be a bug in the Python 2.0 install program.

Quote:
>Also, any reason why in the first case the full path is in sys.argv[0] and in
>the second case just the basename?

In the first case the command shell is doing an expansion.
--

Androgynous poly {*filter*} vanilla {*filter*} het    <*>     http://www.*-*-*.com/
Hugs and backrubs -- I break Rule 6

"Lying.  Cheating.  Stealing.  Hurting people.  These things are bad.
Eating pastry is not bad.  Get a grip!" --jwermont



Sat, 17 May 2003 03:00:00 GMT  
 sys.argv in Python 2.0 does not work?
I tried running the script from both MS-DOS shell and MKS ksh. It works
identically. Korn shell script however launched from the same ksh gets its
arguments just fine. Am I the only one experiencing this problem?


Quote:


>>This seems really stupid. I just installed python 2.0 (after using python
>>1.5.2). Now a simple program like foo.py:

>>        import sys
>>        print sys.argv

>>only prints the list with one argument, the program name, when invoked on
>>WindowsNT 4.0 as follows:

>>> foo.py abcdef
>>['g:\\mydir\\foo.py']

>The whatsis that links extensions to programs isn't passing the
>arguments.  I don't have access to NT these days, so I can't provide any
>more assistance, but if you're familiar with NT, you should be able to
>figure it out.  This may also be a bug in the Python 2.0 install program.

>>Also, any reason why in the first case the full path is in sys.argv[0] and in
>>the second case just the basename?

>In the first case the command shell is doing an expansion.
>--

>Androgynous poly {*filter*} vanilla {*filter*} het    <*>     http://www.*-*-*.com/
>Hugs and backrubs -- I break Rule 6

>"Lying.  Cheating.  Stealing.  Hurting people.  These things are bad.
>Eating pastry is not bad.  Get a grip!" --jwermont



Tue, 20 May 2003 13:37:42 GMT  
 sys.argv in Python 2.0 does not work?

Quote:

> I tried running the script from both MS-DOS shell and MKS ksh. It
works
> identically. Korn shell script however launched from the same ksh
gets its
> arguments just fine. Am I the only one experiencing this problem?




> >>This seems really stupid. I just installed python 2.0 (after using
python
> >>1.5.2). Now a simple program like foo.py:

> >>   import sys
> >>   print sys.argv

> >>only prints the list with one argument, the program name, when
invoked on
> >>WindowsNT 4.0 as follows:

> >>> foo.py abcdef
> >>['g:\\mydir\\foo.py']

> >The whatsis that links extensions to programs isn't passing the
> >arguments.  I don't have access to NT these days, so I can't provide
any
> >more assistance, but if you're familiar with NT, you should be able
to
> >figure it out.  This may also be a bug in the Python 2.0 install
program.

> >>Also, any reason why in the first case the full path is in sys.argv
[0] and in
> >>the second case just the basename?

> >In the first case the command shell is doing an expansion.
> >--

> >Androgynous poly {*filter*} vanilla {*filter*} het    <*>

http://www.*-*-*.com/

Quote:
> >Hugs and backrubs -- I break Rule 6

> >"Lying.  Cheating.  Stealing.  Hurting people.  These things are bad.
> >Eating pastry is not bad.  Get a grip!" --jwermont

I'm using ActivePython on a NT4 Workstation and have no problems with
this script.
import sys
print sys.argv

Olivier Boudry
it gives the expected result:
['argv.py', 'abcdef']

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Tue, 20 May 2003 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. sys.argv not found

2. Chosing between sys.argv and sys.stdin

3. ARGV not working under Windows (2000)

4. himem.sys takes too much conventional memory in windows98 -clarion program does not work

5. sys.excepthook not working

6. .NET SDK, compiling Python 2.0, anyone done it?

7. understanding sys.argv[]

8. sys module - argv, but no argc ??

9. sys.argv and while loop

10. catch empty sys.argv

11. ?sys.argv values more literally?

12. Win32 problems: Popen3 and sys.argv[0]

 

 
Powered by phpBB® Forum Software