스크립트를 작성 중이며 기본 스크립트를 작동시키는 데 문제가 있습니다. Ghost가 제대로 가져 오지 않는 것 같습니다. 다음과 같은 오류가 계속 발생합니다.
>>>from ghost import Ghost
File "/Library/Python/2.7/site-packages/ghost/__init__.py", line 1, in <module>
from .ghost import Ghost, Error, TimeoutError
File "/Library/Python/2.7/site-packages/ghost/ghost.py", line 23, in <module>
if binding is None:
NameError: name 'binding' is not defined
코드에 특별한 것은 없습니다.
from ghost import Ghost
ghost = Ghost()
PySide와 PyQt가 모두 설치되어 있으며 다음을 수행하여 Ghost를 설치합니다. sudo pip install ghost
Ghost.py 소스 코드 에 따르면 :
...
bindings = ["PySide", "PyQt4"]
for name in bindings:
try:
binding = __import__(name)
break
except ImportError:
continue
if binding is None:
raise Exception("Ghost.py requires PySide or PyQt4")
...
binding
PySide 또는 PyQt4 중 하나 이상이 설치 될 때 정의됩니다. 다음 import
명령문을 사용하여 PySide, PyQt4 (PyQt5 아님) 설치를 확인하십시오 .
import PySide
import PyQt4
BTW, NameError
메시지와 함께 예외 대신에 "Ghost.py requires PySide or PyQt4"
버그가 발생합니다. 그래서 나는 이것을 논평했다 .
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다