[SOLVED] Passing Arguments to a Bash Script from a Python Script
by gIn_gOut from LinuxQuestions.org on (#552SG)
G'Day folks ;)
I have a bit of a "sticky wicket" today, which probably needs only a small tweak to resolve.
I'm passing the path to a file, which is discovered in a python script, for further work over in a bash script. Here's the python-side snippet:
Code:filePath = os.path.realpath(sys.argv[4])
print "This", filePath, "file and path has been identified."
subprocess.Popen(['bash ./receivingScript', filePath], shell=True)The trouble:
Where's the beef?!
Thanks a bunch :)


I have a bit of a "sticky wicket" today, which probably needs only a small tweak to resolve.
I'm passing the path to a file, which is discovered in a python script, for further work over in a bash script. Here's the python-side snippet:
Code:filePath = os.path.realpath(sys.argv[4])
print "This", filePath, "file and path has been identified."
subprocess.Popen(['bash ./receivingScript', filePath], shell=True)The trouble:
- While the string content of "filePath" will expand and print correctly to the console in line 2, and
- our bash script, "receivingScript", will be launched as intended in line 3,
- the string content of "filePath" is not passed along properly as a commandline argument for "receivingScript".
Where's the beef?!
Thanks a bunch :)