You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Inside sdv/demo.py there is a line that imports urllib, which later on is used to call urllib.request.
However, urllib does not have the attribute request unless it has been explicitly exported before by using either from urllib import request or import urllib.request statements.
Because of this, when functions from the sdv.demo sub-package are used before anything else, the code raises an AttributeError (see #224 (comment)).
In order to fix this, we should explicitly import urllib.request instead of just urllib.
Inside a fresh virtualenv, open a simple python prompt and try to run the sdv.demo.load_timeseries_demo function.
$ python
Python 3.6.9 (default, Oct 8 2020, 12:12:24)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from sdv.demo import load_timeseries_demo
>>> data = load_timeseries_demo()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/xals/.virtualenvs/sdv-test/lib/python3.6/site-packages/sdv/demo.py", line 322, in load_timeseries_demo
return load_tabular_demo(dataset_name, table_name, data_path=DATA_PATH, metadata=metadata)
File "/home/xals/.virtualenvs/sdv-test/lib/python3.6/site-packages/sdv/demo.py", line 252, in load_tabular_demo
meta, tables = _load_demo_dataset(dataset_name, data_path)
File "/home/xals/.virtualenvs/sdv-test/lib/python3.6/site-packages/sdv/demo.py", line 158, in _load_demo_dataset
dataset_path = _get_dataset_path(dataset_name, data_path)
File "/home/xals/.virtualenvs/sdv-test/lib/python3.6/site-packages/sdv/demo.py", line 116, in _get_dataset_path
_download(dataset_name, data_path)
File "/home/xals/.virtualenvs/sdv-test/lib/python3.6/site-packages/sdv/demo.py", line 103, in _download
response = urllib.request.urlopen(url)
AttributeError: module 'urllib' has no attribute 'request'
Temporary Workaround
In order to prevent the issue, one can simply import urllib.request explicitly before running the sdv.demo code:
$ python
Python 3.6.9 (default, Oct 8 2020, 12:12:24)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib.request
>>> from sdv.demo import load_timeseries_demo
>>> data = load_timeseries_demo()
>>>
The text was updated successfully, but these errors were encountered:
Inside
sdv/demo.py
there is a line that importsurllib
, which later on is used to callurllib.request
.However,
urllib
does not have the attributerequest
unless it has been explicitly exported before by using eitherfrom urllib import request
orimport urllib.request
statements.Because of this, when functions from the
sdv.demo
sub-package are used before anything else, the code raises anAttributeError
(see #224 (comment)).In order to fix this, we should explicitly import
urllib.request
instead of justurllib
.See the usage examples in the urllib.request docs and this stackoverflow question for reference.
Steps to reproduce
Inside a fresh virtualenv, open a simple
python
prompt and try to run thesdv.demo.load_timeseries_demo
function.Temporary Workaround
In order to prevent the issue, one can simply import
urllib.request
explicitly before running thesdv.demo
code:The text was updated successfully, but these errors were encountered: