【发布时间】:2017-11-06 19:56:15
【问题描述】:
我有一个这样的python程序:
raw_data = sys.stdin.buffer.read(nbytes) # Read from standard input stream
# Do something with raw_data to get output_data HERE...
output_mask = output_data.tostring() # Convert to bytes
sys.stdout.buffer.write(b'results'+output_mask) # Write to standard output stream
然后我使用 Pyinstaller 获取这个 python 程序的 my_py.exe。我在 Python 中使用 subprocess.run() 测试 my_py.exe。没关系。
但是,我需要在 IDL 中调用这个 my_py.exe。 IDL 有this tutorial 关于如何将其SPAWN 命令与管道一起使用。所以我调用 my_py.exe 的 IDL 程序是这样的:
SPAWN['my_py.exe', arg], COUNT=COUNT , UNIT=UNIT
WRITEU, UNIT, nbytes, data_to_stream
READU, UNIT, output_from_exe
不幸的是,上面的 IDL 程序在 READU 处挂起。有人知道我在这里遇到的问题吗?我的python读写有问题吗?
【问题讨论】:
标签: python pipe stdio spawn idl-programming-language