titipata / pubmed_parser

:clipboard: A Python Parser for PubMed Open-Access XML Subset and MEDLINE XML Dataset
http://titipata.github.io/pubmed_parser/
MIT License
564 stars 164 forks source link

python-2.7 import error: No module named 'request' #48

Closed uludag closed 6 years ago

uludag commented 6 years ago

In my environment python-2.7 is not able to find the module urllib.request required by _pubmed_webparser.py.

If I replace the urllib import statement as suggested in this discussion then python2 is able to find the request module:

try:
    from urllib.request import urlopen
except ImportError:
    from urllib2 import urlopen

urlopen is used by the function _parse_outgoing_citationweb in the same file. For all http requests from this file requests library is used except the request made from the function _parse_outgoing_citationweb. It could be possible to use the requests library here as well? to avoid the import.

--mahmut

titipata commented 6 years ago

Thanks so much for the issue @uludag! I fixed it already. Let me know if you see others issue. I mostly develop in Python 3 these days and might overlook few issues with Python 2.

digitalstem commented 6 years ago
import urllib.request, json
ImportError: No module named request

I'm getting the following error plz.. help

baijuct commented 6 years ago

You cannot have request in Python 2, you need to have Python 3 or above.