Running Bash commands in Python

前端 未结 10 1668
礼貌的吻别
礼貌的吻别 2020-11-21 05:16

On my local machine, I run a python script which contains this line

bashCommand = \"cwm --rdf test.rdf --ntriples > test.nt\"
os.system(bashCommand)
         


        
10条回答
  •  伪装坚强ぢ
    2020-11-21 05:57

    Call it with subprocess

    import subprocess
    subprocess.Popen("cwm --rdf test.rdf --ntriples > test.nt")
    

    The error you are getting seems to be because there is no swap module on the server, you should install swap on the server then run the script again

提交回复
热议问题