私はそれを試みましたが、これらの引数を出力しようとすると値は返されません。 私は以下の私のコード発行:パイプを使って外部プログラムを実行し、引数をPythonで渡す
SCRIPT1外部のPythonプログラムを実行します(スクリプト2)
#(...)
proc = subprocess.Popen(['export PYTHONPATH=~/:$PYTHONPATH;' +
'export environment=/path/to/environment/;' +
'python /path/to/my/program/myProgram.py',
'%(date)s' %{'date':date}, '%(time)s' %{'time':time}],
stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=True)
#(...)
スクリプト2 SCRIPT1
#(...)
print sys.argv[0] #prints the name of the command
print sys.argv[1] #it suppose to print the value of the first argument, but it doesn't
print sys.argv[2] #it suppose to print the value of the second argument, but it doesn't
#(...)
あなたは 'shlex.split'を使用してみましたが? – BrainStorm
いいえ、本当にそうではありませんか? –