sys.argv problem in Win 2k
Anand B Pillai
abpillai at lycos.com
Thu Apr 24 09:06:49 EDT 2003
Sure...
#example+
#cmdtest.py
import sys
print sys.argv
for x in sys.argv:
print x
D:\OpensourceApps>cmdtest.py passing arguments
['D:\\OpensourceApps\\cmdtest.py']
D:\OpensourceApps\cmdtest.py
#example-
As you see the arguments I pass are not being printed!
This is the case with all my scripts now. They were working
well when I was on a WinNT workstation :-?
Regards
ABP
Gerhard Haering <gh at ghaering.de> wrote in message news:<mailman.1051177117.30168.python-list at python.org>...
> Anand B Pillai wrote:
> > Hi pythonistas
> >
> > All my python scripts on Win 2k does not take command line arguments.
> > i.e, len(sys.argv) is always 1. Because of this I cannot use any scripts which
> > takes cmd line arguments. [...]
>
> #v+
> D:\tmp>copy con: test.py
> import sys
> print sys.argv
> ^Z
> 1 file(s) copied.
>
> D:\tmp>c:\Python22\python.exe test.py bla blubs
> ['test.py', 'bla', 'blubs']
>
> D:\tmp>test.py bla blubs
> ['D:\\tmp\\test.py', 'bla', 'blubs']
>
> D:\tmp>
> #v-
>
> Works fine here. Can you show exactly what does not work with a test case?
>
> -- Gerhard
More information about the Python-list
mailing list