Open yingbo opened 4 years ago
I encountered the same problem in python 3.6.9, mac
wired, I created another venv, and it works now...
@eden-wang You can check the client.py file to see what it's importing. I'm not sure starting which python 3 version, it requires to import urllib.request
@eden-wang You can check the client.py file to see what it's importing. I'm not sure starting which python 3 version, it requires to
import urllib.request
It is import urllib.request
Just checked it's still import urllib
: https://github.com/druid-io/pydruid/blob/master/pydruid/client.py
It requires import urllib.error
to be imported explicitly.
Looks this issue was fixed already. I'll close this.
client.py
still seems to have import urllib
; where do you see it as fixed?
Hi @lokkju ,
From their latest release: https://github.com/druid-io/pydruid/blob/pydruid-0.5.2/pydruid/client.py#L22, you can see
from six.moves import urllib
. The six.moves
fixed the problem
@yingbo : The code you are referring to is 0.5.2.
Isn't master or 0.6 the latest release? They both have import urllib
https://github.com/druid-io/pydruid/blob/master/pydruid/client.py#L18
I experienced this and fixed it by explicitly adding urllib.error (then later urllib.request) to client.py (thanks @sub007 ).
However, it was funny that running the script in ipython did not raise any exceptions. Anybody knows why?
I have no idea either how the problem was fixed, or even being fixed. Hope the pydruid team can give us an answer.
I encountered this error as well! Per the others, adding import urllib.error
and import urllib.request
to site-packages/pydruid/client.py of my virtualenv resolved the issue.
It was fixed in versin 5.2. However is broken again in 6. I managed to run this by installing 5.2. However this is an odd one, as I only had the problem while running it inside a docker container. Locally 6. works alright.
Looks like with Python 3.9.10 pydruid==0.6.2
, urllib3==1.26.12
the AttributeError: module 'urllib' has no attribute 'error'
isn't produced anymore for me.
Looks like I still have this issue with the 3.11 CPython interpreter and pydruid 6.5. What's interesting is that I don't have this issue when using IPython.
My workaround for now is to explicitely import urllib.error
and urllib.request
in my script.
This issue still occurs for versions: Python 3.10.7
Explicitly importing urllib.request in script solves it.
I got this error:
AttributeError: module 'urllib' has no attribute 'error'
I think in the client.py we should
import urllib.request
other thanimport urllib
, in python 3.7 and python 3.8 at least, but I'm not sure how to fix it to make it works on all python versions.