JovianHQ / opendatasets

A Python library for downloading datasets from Kaggle, Google Drive, and other online sources.
MIT License
319 stars 139 forks source link

Can't import opendatasets on Colab #2

Closed mvortizr closed 3 years ago

mvortizr commented 3 years ago

Trying to import the library on Colab gives this error:


AttributeError: module 'urllib' has no attribute 'urlopen'
mvortizr commented 3 years ago

I'm using

!pip install opendatasets --upgrade

and

import opendatasets as od
ameyalaad commented 3 years ago

Hi, I can confirm this issue occurs with me as well on Google Colab. It seems for python 3 and above, you have to individually import the urllib.requests, and urllib.error module.

The script creating the issue is opendatasets/utils/network.py, where adding the line:

import urllib.request

solves the issue.

@aakashns can I take this up?

aakashns commented 3 years ago

Thanks for reporting! This issue has been fixed in https://github.com/JovianML/opendatasets/commit/662056c04b7612f75ca46148c5fefdbea168aa9f