简体   繁体   中英

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM