May-21-2019, 11:09 PM
Thank you. I have windows on 64 bits which confused me.
I installed scrapy too but get this error
Also wondering should I use scrapy at all. This stuff can be done with requests and bs4 in less lines.
I installed scrapy too but get this error
Error:Traceback (most recent call last):
File "C:\Python36\kodovi\scrap.py", line 1, in <module>
import scrapy
File "C:\Python36\lib\site-packages\scrapy\__init__.py", line 34, in <module>
from scrapy.spiders import Spider
File "C:\Python36\lib\site-packages\scrapy\spiders\__init__.py", line 10, in <
module>
from scrapy.http import Request
File "C:\Python36\lib\site-packages\scrapy\http\__init__.py", line 8, in <modu
le>
from scrapy.http.headers import Headers
File "C:\Python36\lib\site-packages\scrapy\http\headers.py", line 4, in <modul
e>
from scrapy.utils.python import to_unicode
File "C:\Python36\lib\site-packages\scrapy\utils\python.py", line 14, in <modu
le>
from scrapy.utils.decorators import deprecated
File "C:\Python36\lib\site-packages\scrapy\utils\decorators.py", line 4, in <m
odule>
from twisted.internet import defer, threads
File "C:\Python36\lib\site-packages\twisted\internet\defer.py", line 31, in <m
odule>
from twisted.python import lockfile, failure
File "C:\Python36\lib\site-packages\twisted\python\lockfile.py", line 46, in <
module>
import pywintypes
File "C:\Python36\lib\site-packages\win32\lib\pywintypes.py", line 136, in <mo
dule>
__import_pywin32_system_module__("pywintypes", globals())
File "C:\Python36\lib\site-packages\win32\lib\pywintypes.py", line 39, in __im
port_pywin32_system_module__
for suffix_item in imp.get_suffixes():
AttributeError: module 'imp' has no attribute 'get_suffixes'
when trying to execute code:import scrapy from scrapy.crawler import CrawlerProcess class PythonEventsSpider(scrapy.Spider): name = 'pythoneventsspider' start_urls = ['https://www.python.org/events/python-events/',] found_events = [] def parse(self, response): for event in response.xpath('//ul[contains(@class, "list-recentevents")]/li'): event_details = dict() event_details['name'] = event.xpath('h3[@class="event-title"]/a/text()').extract_first() event_details['location'] = event.xpath('p/span[@class="event-location"]/text()').extract_first() event_details['time'] = event.xpath('p/time/text()').extract_first() self.found_events.append(event_details) if __name__ == "__main__": process = CrawlerProcess({ 'LOG_LEVEL': 'ERROR'}) process.crawl(PythonEventsSpider) spider = next(iter(process.crawlers)).spider process.start() for event in spider.found_events: print(event)As per error message it looks that there are some problems with packages.
Also wondering should I use scrapy at all. This stuff can be done with requests and bs4 in less lines.