내장 http 모듈에 매우 이상한 파이썬 문제가 있습니다. 성공적으로 가져 오지만 http.client 속성은 존재하지 않습니까? 파이썬 문서에는 내 형제가 코드를 완벽하게 실행합니다. 그것은 나를 위해, 내 노트북 리눅스 또는 내 맥에서 작동하지 않습니다! 며칠 동안이 문제가 발생했으며 수정해야합니다. 이 예외를 제거 할 때존재하더라도 모듈 속성을 찾을 수 없습니다.
이except (http.client.ResponseNotReady, http.client.CannotSendRequest, http.client.BadStatusLine) as e:
AttributeError: 'module' object has no attribute 'client'
는이 파일에 단지 더있다, 그래서 난 그냥 단순히 어쨌든
내가 할 수 있기 때문에 그 예외를 제거 할 수 없습니다 :
정확한 오류 메시지는 이 문제의 근원을 찾지 못하면 http 모듈 폴더를 검색하고 client.py를 찾습니다.
파이썬 인터프리터에서 help (http)를 입력하면 다음과 같이 응답합니다.
PACKAGE CONTENTS
client
cookiejar
cookies
server
FILE
/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/http/__init__.py
글쎄, 나는 도움 명령 정보가 자동으로 생성되고 그 패키지가 삭제되었을 수도 있다는 것을 알고있다. 그래서 HTTP 디렉토리로 가서 "LS -l은"나에게 제공했던이 :
-rw-r--r-- 1 root wheel 38 6 Apr 21:29 __init__.py
drwxr-xr-x 12 root wheel 408 4 May 21:29 __pycache__
-rw-r--r-- 1 root wheel 44644 6 Apr 21:29 client.py
-rw-r--r-- 1 root wheel 75973 6 Apr 21:29 cookiejar.py
-rw-r--r-- 1 root wheel 20360 6 Apr 21:29 cookies.py
-rw-r--r-- 1 root wheel 44788 6 Apr 21:29 server.py
내가 찾고 된 client.py있다! 심지어 코드가 많아서 액세스 할 수 없습니까?
파이썬 인터프리터에서 액세스하려고 시도 할 수 있습니까?
>>> import http
>>> http.client
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'client'
미리 감사드립니다.
어떤 버전의 파이썬입니까? – Noelkd