当我编写Scrapy\pipeline,然后尝试使用scrapy crawl dmoz时,出现了一个错误:
File "F:\Python\lib\site-packages\scrapy\utils\misc.py", line 42, in load_object
raise ImportError("Error loading object '%s': %s" % (path, e))
ImportError: Error loading object 'tutorial.pipelines.Tutorialpipeline': DLL load failed: %1 is not a valid Win32 application. 更新
问题已解决。当我使用pip install mysql-python时,它安装了32位版本的mysql-python,我卸载了它并下载了64位版本。
然而,我遇到了另一个问题,当我运行爬虫时,它显示:
_mysql_exceptions.ProgrammingError: (1064,"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc,pic)values ('xe4\xbe\x9b\xe5\xba.......' at line 1")我不知道发生了什么,有人能帮我弄清楚吗?
下面是我如何在管道中编写mysql插入函数
def _conditional_insert(self,tx,item):
tx.execute('insert into raw(title,area,date,sclass,link,desc,pic) values (%s,%s,%s,%s,%s,%s,%s) '
(item['title'],item['area'],item['date'],item['sclass'],item['link'],item['desc'],item['pic']))发布于 2015-03-19 16:36:38
问题已解决。当我使用pip install mysql-python时,它安装了32位版本的mysql-python,我卸载了它并下载了64位版本。
https://stackoverflow.com/questions/29138315
复制相似问题