##########
import getopt, sys
swt, arg = getopt.getopt(sys.argv[1:], 'd:vh')
print "swt = ", swt
print "arg = ", arg
##########
and I run it like this under HP/UX:
flash % python test.py -d 1
swt = [('-d', '1')]
arg = []
BUT when I run this on under linux I get:
beach % python test.py -d 1
swt = []
arg = ['1']
The problem is that getopt in linux searches *past* the first
argument "test.py", until it discovers a switch '-d' which happens to
match a switch that python uses.
I fixed this by modifying Python/pythonmain.c to parse the command
arguments manually (thus ignoring getopts entirely).
I haven't noticed anyone else mention this problem, so I'll assume
no one else is affected. But if you would like a patch file or a new
copy of this affected file I would be happy to mail it to you. I'd
be happy to rewrite a local version of getopt that behaves as
expected, but I suspect this is a local problem, and it is trivial to
fix, anyway.
On another note, Python works great on linux. I'm working on some
python programs at work and at home, passing python code i486 and
HP-735 (there is about a 2.5X performance improvement on the HP over
486DX2/66), but functionally there appear to be no compatibility
problems otherwise.
Good show Guido.
thanking-the-hardware-god-for-fast-computers-so-I-can-use-python
instead-of-C++-for-every-thing-ly yr's SteveA
----
\
o/\_ Steve Allen (allen@ksr.com)
<\__,\ Kendall Square Research
"> | Waltham, MA
|
\ "This Ain't No @#$%! Weenie Roast!"