2016-02-18 68 views
4

每当我使用下面的方法调用Python的c代码可执行文件时,我得到一个“错误的文件描述符”错误。当我从命令提示符运行代码时,它工作正常。请帮助!?python上的子进程调用给出错误“错误的文件描述符”

import subprocess 

p = subprocess.call(['C:\Working\Python\celp.exe', '-o', 'ofile'], stdin=subprocess.PIPE, stderr=subprocess.STDOUT) 

In [84]: %run "C:\Working\Python\test.py" 
Error: : Bad file descriptor 
+1

你怎么知道的程序已经用C写的,而不是在C++,Pascal中,MODULA,FORTRAN,COBOL或Brainfuck? – Olaf

+0

或编译为.exe的任何其他语言 – ppperry

+0

请提供回溯。在IPython之外运行此代码时会发生什么? – ppperry

回答

-3

试试这个

import subprocess 

p = subprocess.call(['C:\Working\Python\celp.exe', '-o', 'ofile'], stdin=subprocess.PIPE, stderr=subprocess.STDOUT, shell = True) 
+0

我试过这没用 – sciguy

相关问题