Windows command line problem

MarkE mark.english at liffe.com
Mon Jul 18 17:04:11 CEST 2005


I'm sure someone else has posted a similar problem but I can't find it,
nor the solution...

I have a python script which accepts a command line argument.
E.g.
python.exe myscript.py -n Foo

I build this as part of a package using distutils with the
bdist_wininst option on a Windows 2K (SP4) machine.
I have tested installing and running it fine on a Windows XP (SP2)
machine. I build my package-installer with a Python.org 2.4.1
distribution which is source-compiled locally. I have installed my
package-installer on a machine running ActiveState Python 2.4.1
installed from a .msi file.
That all works fine.

I have problems delivering it to the test team (of course). After some
investigation, if I install the package on one of our test machines and
butcher my installed file to dump the command line and exit (i.e. print
'hi', sys.argv) then I get the following:
hi ['c:\\Python24\\Lib\\site-packages\\MyPackage\\myscript.py', '\x96n,
'Foo']

If I run it specifying --name instead of -n I get:
hi ['c:\\Python24\\Lib\\site-packages\\MyPackage\\myscript.py',
'\x96-name, 'Foo']

The machine in question is also running XP service pack 2 as far as I
know, with Python.org's 2.4.1 distribution.

Does anyone know why the first character on the command line (here '-')
is getting adjusted (to '\x96') in this way ? Is it a Unicode/encodings
kind of a problem ? I can make the problem go away by running with
quotes like this:
python.exe myscript.py "-n" Foo

I'm hoping I can add an entry to my setup.py. Thanks for any and all
help.
Mark




More information about the Python-list mailing list