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_'的輸出 –
對不起,我不理解你。我怎樣才能做到這一點 –