0

I want 1.py to call 2.py.

1.py takes an Ip address as a command line argument. I am trying a 'subprocess.call()' in 1.py to call 2.py.

I have defined addr= sys.argv[1] before the main() of 1.py. I want the same address to be accessed in 2.py.

In short, 1.py should call 2.py, which in turn calls 3.py and so on, just by one command

python 1.py ipaddress and this address has to be passed on to all other scripts. how can this be done?

To add on...

i have used

subprocess.call(,shell=True) within the main of 1.py

also have defined addr=sys.argv[1] before the main() of 2.py

I know I am wrong somewhere in taking that system argument, but not able to nail it.

it is giving me the error:

self.transportAddr = (
socket.gaierror:(11001,'getaddrinfo failed')

Thanks for the patient reading!

Edited by novice20: n/a

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by slate
0

You pass the string addr to 2.py. Try printing out the command before you make the call.

Correctly:
subprocess.call( ,shell=True)

Edited by slate: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.