Search code examples
pythonpipesubprocesspopen

subprocess.popen( ) executing Python script but not writing to a file


I am trying to run a Python program from inside another Python program using these commands:

  1. subprocess.call(self.runcmd, shell=True);

  2. subprocess.Popen(self.runcmd, shell=True); and

  3. self.runcmd = " python /home/john/createRecordSet.py /home/john/sampleFeature.dish "

Now the script runs fine but the file its supposed to write to is not even getting created, i'm using "w" mode for creating and writing


Solution

  • The absolute path of Python in self.runcmd should do the magic!

    Try using the absolute path of file name while opening the file in write mode.