I found the code of tools/misc.py
@function def exec_command_pipe(name, *args):
return os.popen2(cmd, 'b')
and I found the follow code in addons/base/ir/workflow/print_instance.py
input, output = tools.exec_command_pipe(*args) #here ref:http://docs.python.org/library/popen2.html input.write(ps_string) input.close() self.result = output.read() output.close()
@ python manual says: 1st parameter is stdout, 2nd parameter is stdin.
Is it a bug?
and I try test.py @WinXP v5.0.6
import os
cmd = r'ps2pdf.bat - -' (output, input) = os.popen2(cmd, 'b')
fp = file('test.ps', 'r') fpContent = ''.join(fp.readlines()) fp.close()
input.write(fpContent+'\n') input.close() result = output.read() output.close() print result
I catch a exception:
Traceback (most recent call last): File "test.py", line 10, in <module> input.write(fpContent+'\n') IOError: [Errno 9] Bad file descriptor
I found the code of tools/misc.py
@function def exec_command_ pipe(name, *args):
return os.popen2(cmd, 'b')
and I found the follow code in addons/ base/ir/ workflow/ print_instance. py
input, output = tools.exec_ command_ pipe(*args) #here ref:http:// docs.python. org/library/ popen2. html
input. write(ps_ string)
input. close()
output. close()
self.result = output.read()
@ python manual says: 1st parameter is stdout, 2nd parameter is stdin.
Is it a bug?
and I try test.py @WinXP v5.0.6
import os
cmd = r'ps2pdf.bat - -'
(output, input) = os.popen2(cmd, 'b')
fp = file('test.ps', 'r') fp.readlines( ))
fpContent = ''.join(
fp.close()
input.write( fpContent+ '\n')
input.close()
result = output.read()
output.close()
print result
I catch a exception:
Traceback (most recent call last): write(fpContent +'\n')
File "test.py", line 10, in <module>
input.
IOError: [Errno 9] Bad file descriptor