开发者

Python subprocess Help

开发者 https://www.devze.com 2023-01-04 20:54 出处:网络
I\'m testing python subprocess and I keep getting this error: $ python subprocess-test.py Traceback (most recent call last):

I'm testing python subprocess and I keep getting this error:

$ python subprocess-test.py 
Traceback (most recent call last):
  File "subprocess-test.py", line 3, in <module>
    p = subprocess.Popen(['rsync', '-开发者_C百科azP', 'rsync://cdimage.ubuntu.com/cdimage/daily-live/current/maverick-desktop-amd64.iso', '/home/roaksoax/Desktop/iso'], stdout=subprocess.PIPE)
AttributeError: 'module' object has no attribute 'Popen'

My script is:

import subprocess
p = subprocess.Popen(['rsync', '-azP', 'rsync://cdimage.ubuntu.com/cdimage/daily-live/current/maverick-desktop-amd64.iso', '/home/testing/maverick.iso'], stdout=subprocess.PIPE)

Do you guys know what might be happening?


Wild guess: you have your own file called subprocess.py which is masking the standard library module.

What do you see with this?:

import subprocess
print subprocess.__file__

This will show what file is being imported as subprocess.

0

精彩评论

暂无评论...
验证码 换一张
取 消