我尝试从命令中运行带有ini配置文件的python脚本的Windows命令行应用程序,我怀疑它没有在执行时传递。使用ini文件参数从python运行windows命令行程序
该命令是c:\ BLScan \ blscan.exe test.ini。
ini文件是应用程序需要知道要扫描的参数的配置文件。
这是使用
import subprocess
from subprocess import Popen, PIPE
cmd = '/blscan/blscan test.ini'
p = Popen(cmd , stdout=PIPE, stderr=PIPE)
out, err = p.communicate()
print "Return code: ", p.returncode
print out.rstrip(), err.rstrip()
当我使用subprocess.popen调用应用程序它不看要读ini文件脚本IM。设备线是一个指示器,表明调音器没有从ini文件中识别出来,因此程序正在下降到默认调谐器。
Return code: 0
BLScan ver.1.1.0.1091-commited
Config name: .\test.ini
Device 0: TBS 6925 DVBS/S2 Tuner
Device number: Total Scan Time = 0.000s
Transponders not found !
>>>
这是从dos shell运行时的样子。
C:\BLScan>blscan test.ini
BLScan ver.1.1.0.1091-commited
Config name: .\test.ini
Scan interval 0
From 3400 to 3430 Mhz, Step 5 Mhz, Horizontal, Minimal SR 1000 KS, Maximal SR 10
0000 KS
3400 Mhz ...
3405 Mhz ...
3410 Mhz ...
任何意见将理解
感谢您花时间解决问题和解决方案。现在正常工作:) – satraver 2013-05-04 21:36:41