is perl better?

Mel Wilson mwilson at the-wire.com
Fri Mar 5 15:49:00 EST 2004


In article <mailman.28.1078507301.19534.python-list at python.org>,
"jon c" <jon_couchman at hotmail.com> wrote:
>>>well the cammand is
>>>
>>>java -hotspot -showversion ...... -classpath loads of entries
>>>application-name
>>>
>>>the total string is 6809 characters long.
>>>
>>>I do not know the allowed character length (I am using windows 2000)
>>>
>>>but perl just runs the command fine, whereas python results in
>>>
>>>The following character string is too long:
>
>>Is that coming from Windows or Python?  If the latter, give us the full
>>exception message, which will say from where in Python.  Also, try putting
>>the long string in a .bat file and running the .bat file by itself and then
>>from Python.
>
>>Terry J. Reedy
>
>
>the error is coming from windows!
>
>the error message is as I wrote it.
>
>if you try and execute the command directly from bat you get the error input
>line too long!
>
>can perl be somehow bypassing the windows terminal and running the command
>directly (does this make sense?)


Avoiding the command line might help.  This runs in WinNT 4:



#=======================================
"""test_huge_command.py
"""
import os

command = r'e:\bin\python23\python.exe'

pid = os.spawnv (os.P_WAIT, command
                , [command, 'number_args.py']
                    + ['arg-%d'%(i,) for i in xrange (1000)]
        )



#=======================================
"""number_args.py
"""
import sys

argc = len (sys.argv)
print "Called with %d arguments" % (argc,)
for i in xrange (min (3, argc)):
    print "%d\t%s" % (i, sys.argv[i])
for i in xrange (max (3, argc-3), argc):
    print "%d\t%s" % (i, sys.argv[i])
print



#=======================================
f:\home\mwilson\projects\python>python test_huge_command.py
Called with 1001 arguments
0       number_args.py
1       arg-0
2       arg-1
998     arg-997
999     arg-998
1000    arg-999



        Regards.        Mel.



More information about the Python-list mailing list