0
我初学Python编程而我申请子模块的一个例子,我遇到了一个错误Python的子进程模块
的例子:
#!/usr/bin/python
import subprocess
handle = subprocess. Popen("ls", stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
handle.stdout.read()
遇到的错误:
AttributeError: 'module' objecthas no attribute 'Popen'
提前致谢。
谢谢你的回答。 'file.py'被称为'example.py'。该命令在Python shell中正确执行,但是当保存在文件中时发生此错误 –
@PythonLover添加'print subprocess .__ file_'的输出 –
对不起,我不理解你。我怎样才能做到这一点 –