问题
为什么 Pyinstaller 不能处理goose
文件?是可执行文件创建者还是我的代码有问题?
代码
from goose.Goose import Goose
url =
'http://sociedad.elpais.com/sociedad/2012/10/27/actualidad/1351332873_157836.html'
g = Goose({'debug':False,'enableImageFetching': False,'localStoragePath':'./tmp'})
article = g.extractContent(url=url)
#article.title
print article.cleanedArticleText[:150].encode("utf8","ignore")
Pyinstaller 的错误日志
我使用 pyinstaller 创建的程序无法在此路径中找到 goose 文件:
IOError: Couldn't open file C:\Users\user\Desktop\dist\main.exe?118272\goose/resources/text/stopwords-en.txt
有时候是这样的:
Traceback (most recent call last):
File "<string>", line 15, in <module>
File "C:\Users\user\Desktop\build\pyi.win32\main\out00-PYZ.pyz\goose.Goose",line 52, in extractContent
File "C:\Users\user\Desktop\build\pyi.win32\main\out00-PYZ.pyz\goose.Goose",line 59, in sendToActor
File "C:\Users\user\Desktop\build\pyi.win32\main\out00-PYZ.pyz\goose.Crawler", line 86, in crawl
File "C:\Users\user\Desktop\build\pyi.win32\main\out00-PYZ.pyz\goose.extractors", line 245, in calculateBestNodeBasedOnClustering
File "C:\Users\user\Desktop\build\pyi.win32\main\out00-PYZ.pyz\goose.text", line 97, in __init__
File "C:\Users\user\Desktop\build\pyi.win32\main\out00-PYZ.pyz\goose.utils",line 76, in loadResourceFile
IOError: Couldn't open file C:\Users\user\Desktop\dist\main.exe?118272\goose/resources/text/stopwords-en.txt
怎么了?