Parameter Passing - String Variable Truncated ?

goldtech goldtech at worldpost.com
Fri Aug 31 19:54:02 EDT 2007


Hi,

I'm passing what I think is a string parameter to another Python
program (spawn.py)  - see the code snip below. But only the counter
part gets printed to a log file via  spawn.py. Yet the echo print to
the output window shows the whole string with the fc part. Better
explained below I hope, there's the calling .py and the spawn
script .py:
...snip...
while fc:
    counter = counter + 1
    fc_cntr = str(counter) + ' : ' + fc
    print fc_cntr + '\n'  # Print to Pythonwin interactive window -
eg. "1 : New York" - all is printed OK

    arglist = []
    arglist.append(pythonPath)
    arglist.append(spawn_script)
    arglist.append(fc_cntr)  # This gets sent to the spawn_script but
only "1" gets printed

    os.spawnv(os.P_WAIT, pythonPath, arglist)
    fc = fcs.next()
...
--------------------------
## the spawn_script
import win32com.client, sys, os, time, re

in_featclass = sys.argv[1]
handle = open('C:\\log_file.txt', 'a')
handle.write(in_featclass + "\n") # ONLY the counter part gets printed
to the log file!    Why?
--------------------------

Thanks, for help.




More information about the Python-list mailing list