2013-07-10 5 views
0

winexpect librairie winexpect를 사용하려고했지만 Windows에서 실패했습니다! 파이썬 librairie winexpect가 작동하지 않습니다

>>> import pexpect 
>>> pexpect.spawn(" ") 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "c:\python26\lib\site-packages\winpexpect-1.5-py2.6.egg\pexpect.py", line 
429, in __init__ 
    self._spawn (command, args) 
    File "c:\python26\lib\site-packages\winpexpect-1.5-py2.6.egg\pexpect.py", line 
527, in _spawn 
    self.pid, self.child_fd = pty.fork() 
NameError: global name 'pty' is not defined 

그러나 리눅스에서 작동 : 나는 두 플랫폼에서 easy_install을 사용하여 설치 한

>>> import pexpect 
>>> pexpect.spawn(' ') 
<pexpect.spawn object at 0x7f5330c78610> 

.

>:\Python26\Scripts\easy_install.exe winpexpect 
Searching for winpexpect 
Best match: winpexpect 1.5 
Processing winpexpect-1.5-py2.6.egg 
winpexpect 1.5 is already the active version in easy-install.pth 

Using c:\python26\lib\site-packages\winpexpect-1.5-py2.6.egg 
Processing dependencies for winpexpect 
Finished processing dependencies for winpexpect 

감사합니다.

답변

0

당신이 winexpect 설치 한 후에는이 방법을 사용할 수 있습니다

import winpexpect 
winexpect.winspawn(' ') 
관련 문제