0
프로젝트에 feedparser (http://www.feedparser.org)가 필요하며 제 3 자 모듈을 별도의 폴더에 보관하려고합니다. 필자는 python 경로에 폴더를 추가하고 feedparser 중 적절한 모듈을 거기에 두어이 작업을 수행했습니다. "소켓 시간 제한, 추가 ..."feedparser - 다양한 오류
feedparser를 가져 오는 첫 번째 시도는 내가 텍스트를 발견
>>> import feedparser Traceback (most recent call last): File "", line 1, in File "/home/users/me/modules/feedparser.py", line 1 ed socket timeout; added support for chardet library ^ SyntaxError: invalid syntax결과 코멘트에서 파일의 맨 아래에 이러한 주석을 제거하고 다시 시도 :
>>> import feedparser Traceback (most recent call last): File "", line 1, in File "/home/users/me/modules/feedparser.py", line 1 = [(key, value) for key, value in attrs if key in self.acceptable_attributes] ^ IndentationError: unexpected indent
좋아, 일부 들여 쓰기 오류. 나는 문제의 함수에서 들여 쓰기를 확인했다. ok (어떤 줄은 아무 들여 쓰지 않은 줄로 옮겼다.)이다. 그리고 다시 시도 :
>>> import feedparser Traceback (most recent call last): File "", line 1, in File "/home/users/me/modules/feedparser.py", line 1 , value) for key, value in attrs if key in self.acceptable_attributes] ^ SyntaxError: invalid syntax
만큼, 내가 구문 뭐 잘못 찾을 수 없습니다 내가 구글 :
def unknown_starttag(self, tag, attrs):
if not tag in self.acceptable_elements:
if tag in self.unacceptable_elements_with_end_tag:
self.unacceptablestack += 1
return
attrs = self.normalize_attrs(attrs)
attrs = [(key, value) for key, value in attrs if key in self.acceptable_attributes]
_BaseHTMLProcessor.unknown_starttag(self, tag, attrs)
지금 무엇을? 내 방식이 모두 잘못 되었습니까? 왜 잘 테스트되고 신뢰할 수있는 모듈에서 이러한 오류가 발생합니까?
는 "당신 같은 소리 feedparser.py의 복사본이 손상되었습니다. " 이렇게하면 파일을 서버에 다시 업로드 할 수 있습니다. 전에 여러 번 해본 적이 있지만 MacFUSE (끌어서 놓기 창을 통해 내려 받기)를 사용합니다. "정상적인"FPT 클라이언트를 사용하면 어디서 제대로 작동하는지 알 수있었습니다. 파일이 어떤 식 으로든 손상되었습니다. 답변 해 주셔서 감사합니다. – Eiriks
알려 주셔서 감사합니다. 이제 고쳐 졌기 때문에 다행입니다. – mikej