passing arguments from a python program to other while executing it with exec() or spawn() in LINUX

gaurav kashyap gauravkec2005 at gmail.com
Thu Oct 16 02:57:52 EDT 2008


HI all,
i have two python programs as 1.py and 2.py

1.py
import os
import sys
processID=os.spawnl(os.P_WAIT,'/usr/local/bin/python','python','/
mywork/2.py ' + 'hi')

2.py
import sys
domain= str(sys.argv[1] )
print domain

IN LINUX
while executing 1.py,the argument 'hi' is not passed to the 2.py and
error message is displayed as :
python: can't open file '/mywork/2.py'.If i execute the program from
shell like:
python 2.py hi,then it works fine


IN WINDOWS
this is working fine

PLEASE HELP.
thanks
gaurav



More information about the Python-list mailing list