Parsing a commandline from within Python

andreas.huesgen at andreas.huesgen at
Thu Oct 11 16:19:39 CEST 2007


I am writing a commandline tool in Python which is often feed with lots of commandline arguments. In practice, the commandline already reached a critical length which is to long for Windows (some versions of Windows only support commandlines of up to 2047 characters). To work around this problem, we thought up the idea of bypassing the commandline into a file and then letting Python parse the content of the file the same way, the arguments in sys.argv are parsed.

Is there any buildin function which mimics the behavior of the standard commandline parser (generating a list of strings "foo bar" and "some text" from the commandline <"foo bar" "some text">)?

If not, do you have any other ideas how to handle this problem (increasing commandline length, xml files might be a way)?


Andreas Huesgen

Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren
ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT FÜR ALLE NEUEINSTEIGER
Jetzt bei Arcor: günstig und schnell mit DSL - das All-Inclusive-Paket
für clevere Doppel-Sparer, nur  34,95 €  inkl. DSL- und ISDN-Grundgebühr!

More information about the Python-list mailing list