is perl better?

J

jon c

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:

.........

_________________________________________________________________
Use MSN Messenger to send music and pics to your friends
http://www.msn.co.uk/messenger
 
P

Peter Hansen

jon said:
well the cammand is

java -hotspot -showversion ...... -classpath loads of entries
application-name

Okay, I accept that the string being passed in is very long, and that
the details aren't relevant here. How about some example code? From
the Perl one that works, and the Python one that doesn't. There are a
dozen ways of invoking external programs...
the total string is 6809 characters long.

This is likely far too long for the Windows command line, but perhaps
2000 is more sophisticated than I would expect...
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 the sum total of the error message? Is it coming from Python,
or from the shell, or what? Sometimes cutting and pasting the actual
string helps. Unless that's really all there was, other than the string
itself.

Without more info, all I can suggest is try using popen instead of
os.system, but that's just guessing since we don't know you _are_ using
os.system right now.

-Peter
 
T

Thomas Heller

the total string is 6809 characters long.
This is likely far too long for the Windows command line, but perhaps
2000 is more sophisticated than I would expect...

Just to throw in some real numbers, MSDN knowledge base article 830473
<http://support.microsoft.com/default.aspx?scid=kb;en-us;830473>
says:

"""
On computers running Microsoft Windows XP or later, the maximum length
of the string that you can use at the command prompt is 8191
characters. On computers running Microsoft Windows 2000 or Windows NT
4.0, the maximum length of the string that you can use at the command
prompt is 2047 characters.

This limitation applies to the command line, individual environment
variables (such as the PATH variable) that are inherited by other
processes, and all environment variable expansions. If you use Command
Prompt to run batch files, this limitation also applies to batch file
processing.
"""

Read the article to found out more (but not much more).

BTW: The workarounds that the article mentions sound more like the old
MSDOS days than like a modern operating system.
Ridiculous examples:
# Use shorter names for folders and files.

# Reduce the depth of folder trees.

# Store files in fewer folders so that fewer folders are
# required in the PATH environment variable.

Thomas
 
?

=?ISO-8859-1?Q?Bernard_Delm=E9e?=

jon said:
well the cammand is

java -hotspot -showversion ...... -classpath loads of entries
application-name

the total string is 6809 characters long.

Maybe a workaround would be to use the CLASSPATH environment
variable instead of the command line -classpath parameter
(using os.environ from python). Hopefully this would make your
command line short enough not to hit any hard limit.

os.environ[ 'CLASSPATH' ] = 'lib1.jar:...:libN.jar'
os.system ( 'java -hotspot -showversion application-name' )


Hope this helps,

Bernard.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top