os.system limitations on Windows NT

Markus Kohler kohler at medien.tecmath.de
Fri Oct 27 04:36:15 EDT 2000


Hallo  Georg,

Georg Mischler schrieb in Nachricht <8t6g1o$21i$1 at nnrp1.deja.com>...
>Markus Kohler wrote:
>> Hi,
>> I trying to execute a command with a large list of arguments.
>> When I do os.system("link " + args) the program crashes.
>> When I write the arguments to a file (fileName) and use
>>
>> os.system ("link @" + fileName)
>>
>> the arguments are truncated at an arbitrary point.
>>
>> I'm using Python 1.5.2
>>
>> Anyone knows a workaround/solution for this
>> problem ?
>
>os.system() starts a command shell to interpret the arguments
>and then pass them to the actual program you told it to call.
>Windows shells, such as command.com for Win9x and cmd.com for
>NT/w2k, have an arbitrary limit on the lenght of argument lists.
>As long as you can't avoid the use either os.system() or
>os.popen(), there's no easy way around the problem.
>


OK, That's why I use "link @linkArgs"
which should read the arguments from the File linkArgs.
This command line is short isn't it ?

>A possible workaround might be to pass some of the arguments
>in the form of environment variables (which again have limits
>of their own), or just shorten the arguments in some other way.
>All those limits are defined in terms of a maximum number of
>chararcers, though I don't remember the exact values. Note
>that unix shells may have similar limits, but the acceptable
>sizes are usually much bigger there.


Yes. Unix is my next step.

>
>The "correct" solution would be to use Mark Hammond's win32
>extensions to Python, and work with win32process.CreateProcess(),
>which doesn't appear to have any of this kind of limitations.


Oh, it is in win32process module.
I was looking for that function.

Thanks,
Markus

















More information about the Python-list mailing list