当前位置: 动力学知识库 > 问答 > 编程问答 >

I can't redirect output of a python file from a php call

问题描述:

I'm trying to execute a python file from php, in python file I have this:

import sys

from subprocess import PIPE, Popen

nom = sys.argv[1];

print nom

def cmdline(command):

process = Popen(

args=command,

stdout=PIPE,

shell=True

)

return process.communicate()[0]

cmdline("nmap x.x.x.x -oX sortida.xml")

When I execute python pythonfile.py works, creates the sortida.xml file, but when y call it from php don't create sortida.xml file, only shows me the print

PHP:

 system('python /var/www/core/un.py q');

Thanks in advance

分享给朋友:
您可能感兴趣的文章:
随机阅读: