How do I fix timezone import error on Bash for webscraper?

87 Views Asked by At

I'm trying to use the wayback-machine-scraper, a command-line utility, to pull data from archived sites. The scraper needs to be run in Bash, but requires timezone, which I can only find for Python 3.X. If I switch over to python, then I get a syntax error on the wayback-machine-scraper. I need to use this scraper specifically because it allows for searches for nearest archived sites and date ranges.

wayback-machine-scraper -o 'www.nytimes.com' www.nytimes.com

Output

    Traceback (most recent call last):
    File "/usr/local/bin/wayback-machine-scraper", line 11, in <module>
load_entry_point('wayback-machine-scraper==1.0.7', 'console_scripts', 'wayback-machine-scraper')() 
    File "/Users/username/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 484, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
    File "/Users/username/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 2714, in load_entry_point
return ep.load()
    File "/Users/username/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 2332, in load
return self.resolve()
    File "/Users/username/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 2338, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
    File "/Library/Python/2.7/site-packages/wayback_machine_scraper/__main__.py", line 7, in <module>
from .mirror_spider import MirrorSpider
    File "/Library/Python/2.7/site-packages/wayback_machine_scraper/mirror_spider.py", line 7, in <module>
from scrapy_wayback_machine import WaybackMachineMiddleware
    File "/Library/Python/2.7/site-packages/scrapy_wayback_machine/__init__.py", line 2, in <module>
from datetime import datetime, timezone
    ImportError: cannot import name timezone

Sorry if this isn't formatted perfectly. It's my first time posting on here. Thanks for all your help!

0

There are 0 best solutions below