Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

urllib.request issue #3

Closed
Ianleeclark opened this issue Nov 18, 2015 · 4 comments
Closed

urllib.request issue #3

Ianleeclark opened this issue Nov 18, 2015 · 4 comments
Labels

Comments

@Ianleeclark
Copy link

While fixing #2, I ran accross an issue where if I install the script, I can't run xkcd-dl without getting a nag about request

xkcd-dl --download=934
Downloading xkcd from 'http://xkcd.com/934/' and storing it under '/home/tinyl_server/xkcd_archive/934'
Traceback (most recent call last):
  File "/usr/local/bin/xkcd-dl", line 9, in <module>
    load_entry_point('xkcd-dl==0.0.5', 'console_scripts', 'xkcd-dl')()
  File "/usr/local/lib/python2.7/dist-packages/xkcd_dl-0.0.5-py2.7.egg/bin/main.py", line 314, in main
    download_xkcd_number()
  File "/usr/local/lib/python2.7/dist-packages/xkcd_dl-0.0.5-py2.7.egg/bin/main.py", line 286, in download_xkcd_number
    urllib.request.urlretrieve(complete_img_url, file_name)
AttributeError: 'module' object has no attribute 'request'

I don't know if you're not getting this, but I am.

UNLESS, if I run python main.py --download=934 and I change import urllib.request to import urllib, then everything runs.

I want to submit a pull request for #2, but as it stands, I don't know if I'm going to be introducing more bugs into the program by doing so.

@Ianleeclark
Copy link
Author

Why is Python 2.7 still a thing. I'm switching to 3.

@tasdikrahman
Copy link
Owner

I would suggest you use python 3.*. As the urllib2 module has been divided across several modules in python3.* named as urllib.requestand urllib.error.

@tasdikrahman tasdikrahman reopened this Nov 18, 2015
@tasdikrahman
Copy link
Owner

Did switching to python 3.* resolve the issue? If so please close this issue and submit a pull request once you fix #2

@Ianleeclark
Copy link
Author

Yes, it does resolve the issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants