Article 552SG [SOLVED] Passing Arguments to a Bash Script from a Python Script

[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:
  1. While the string content of "filePath" will expand and print correctly to the console in line 2, and
  2. our bash script, "receivingScript", will be launched as intended in line 3,
  3. the string content of "filePath" is not passed along properly as a commandline argument for "receivingScript".
In sum, whatever gets through to the bash script seems to be completely empty.

Where's the beef?!

Thanks a bunch :)latest?d=yIl2AUoC8zA latest?i=fiPM8X0RzNg:KGIHNekUvVY:F7zBnMy latest?i=fiPM8X0RzNg:KGIHNekUvVY:V_sGLiP latest?d=qj6IDK7rITs latest?i=fiPM8X0RzNg:KGIHNekUvVY:gIN9vFwfiPM8X0RzNg
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments