2 lyq zbb lyq_zbb 于 2013.11.20 11:11 提问

scrapy配置问题,求大家帮忙啊

配置scrapy 我是按照http://blog.csdn.net/wukaibo1986/article/details/8167590配置的 创建项目可以 但是运行项目的时候报错,做的demo是按照
http://www.oschina.net/translate/scrapy-demo做的 求解释:
E:\爬虫\tutorial>scrapy crawl dmoz
2013-11-20 11:09:50+0800 [scrapy] INFO: Scrapy 0.20.0 started (bot: tutorial)
2013-11-20 11:09:50+0800 [scrapy] DEBUG: Optional features available: ssl, http11
2013-11-20 11:09:50+0800 [scrapy] DEBUG: Overridden settings: {'NEWSPIDER_MODULE': 'tutorial.spiders', 'SPIDER_MODULES': ['tutorial.spiders'], 'BOT_NAME': 'tutorial'}
2013-11-20 11:09:50+0800 [scrapy] DEBUG: Enabled extensions: LogStats, TelnetConsole, CloseSpider, WebService, CoreStats, SpiderState
Traceback (most recent call last):
File "C:\Python27\lib\runpy.py", line 162, in run_module_as_main
"
_main__", fname, loader, pkg_name)
File "C:\Python27\lib\runpy.py", line 72, in run_code
exec code in run_globals
File "C:\Python27\lib\site-packages\scrapy-0.20.0-py2.7.egg\scrapy\cmdline.py", line 168, in
execute()
File "C:\Python27\lib\site-packages\scrapy-0.20.0-py2.7.egg\scrapy\cmdline.py", line 143, in execute
_run_print_help(parser, _run_command, cmd, args, opts)
File "C:\Python27\lib\site-packages\scrapy-0.20.0-py2.7.egg\scrapy\cmdline.py", line 89, in _run_print_help
func(*a, **kw)
File "C:\Python27\lib\site-packages\scrapy-0.20.0-py2.7.egg\scrapy\cmdline.py", line 150, in _run_command
cmd.run(args, opts)
File "C:\Python27\lib\site-packages\scrapy-0.20.0-py2.7.egg\scrapy\commands\crawl.py", line 50, in run
self.crawler_process.start()
File "C:\Python27\lib\site-packages\scrapy-0.20.0-py2.7.egg\scrapy\crawler.py", line 92, in start
if self.start_crawling():
File "C:\Python27\lib\site-packages\scrapy-0.20.0-py2.7.egg\scrapy\crawler.py", line 124, in start_crawling
return self._start_crawler() is not None
File "C:\Python27\lib\site-packages\scrapy-0.20.0-py2.7.egg\scrapy\crawler.py", line 139, in _start_crawler
crawler.configure()
File "C:\Python27\lib\site-packages\scrapy-0.20.0-py2.7.egg\scrapy\crawler.py", line 47, in configure
self.engine = ExecutionEngine(self, self._spider_closed)
File "C:\Python27\lib\site-packages\scrapy-0.20.0-py2.7.egg\scrapy\core\engine.py", line 63, in __init
_
self.downloader = Downloader(crawler)
File "C:\Python27\lib\site-packages\scrapy-0.20.0-py2.7.egg\scrapy\core\downloader__init__.py", line 73, in init
self.handlers = DownloadHandlers(crawler)
File "C:\Python27\lib\site-packages\scrapy-0.20.0-py2.7.egg\scrapy\core\downloader\handlers__init__.py", line 18, in init
cls = load_object(clspath)
File "C:\Python27\lib\site-packages\scrapy-0.20.0-py2.7.egg\scrapy\utils\misc.py", line 40, in load_object
mod = import_module(module)
File "C:\Python27\lib\importlib__init__.py", line 37, in import_module
import(name)
File "C:\Python27\lib\site-packages\scrapy-0.20.0-py2.7.egg\scrapy\core\downloader\handlers\s3.py", line 4, in
from .http import HTTPDownloadHandler
File "C:\Python27\lib\site-packages\scrapy-0.20.0-py2.7.egg\scrapy\core\downloader\handlers\http.py", line 5, in
from .http11 import HTTP11DownloadHandler as HTTPDownloadHandler
File "C:\Python27\lib\site-packages\scrapy-0.20.0-py2.7.egg\scrapy\core\downloader\handlers\http11.py", line 17, in
from scrapy.responsetypes import responsetypes
File "C:\Python27\lib\site-packages\scrapy-0.20.0-py2.7.egg\scrapy\responsetypes.py", line 113, in
responsetypes = ResponseTypes()
File "C:\Python27\lib\site-packages\scrapy-0.20.0-py2.7.egg\scrapy\responsetypes.py", line 34, in init
self.mimetypes = MimeTypes()
File "C:\Python27\lib\mimetypes.py", line 66, in init
init()
File "C:\Python27\lib\mimetypes.py", line 358, in init
db.read_windows_registry()
File "C:\Python27\lib\mimetypes.py", line 258, in read_windows_registry
for subkeyname in enum_types(hkcr):
File "C:\Python27\lib\mimetypes.py", line 249, in enum_types
ctype = ctype.encode(default_encoding) # omit in 3.x!
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd7 in position 9: ordinal not in range(128)

3个回答

huangxinguan
huangxinguan   2013.12.17 15:02
已采纳

按照上面安装的方法,需要安装
pywin32-218.win32-py2.7.exe

Twisted-13.1.0.win32-py2.7.exe

zope.interface-4.0.5.win32-py2.7.exe

lxml-3.2.3.win32-py2.7.exe

pyOpenSSL-0.11.winxp32-py2.7.exe

这些,你少安装了pywin32-218.win32-py2.7.exe,安装上就好了

ToGoCi
ToGoCi   2014.01.02 21:22

遇到同样的问题.推荐查看:http://bugs.python.org/review/9291/diff/1663/Lib/mimetypes.py
上面说是mimetypes initialization fails on Windows because of non-Latin characters in registry

xuyanjie0903
xuyanjie0903   2014.08.11 20:02
Csdn user default icon
上传中...
上传图片
插入图片