Anyways, I can get the following example code to work just fine from an interactive python prompt;
Code: Select all
import urllib3
http = urllib3.PoolManager()
r = http.request('GET', 'http://127.0.0.1:8080/foo.html')
print(r.status)
print(r.data)Code: Select all
Traceback (most recent call last):
File "http_2.py", line 1, in <module>
import urllib3
File "/usr/lib/python3.7/site-packages/urllib3/__init__.py", line 7, in <module>
from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool, connection_from_url
File "/usr/lib/python3.7/site-packages/urllib3/connectionpool.py", line 11, in <module>
from .exceptions import (
File "/usr/lib/python3.7/site-packages/urllib3/exceptions.py", line 2, in <module>
from .packages.six.moves.http_client import IncompleteRead as httplib_IncompleteRead
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "/usr/lib/python3.7/site-packages/urllib3/packages/six.py", line 199, in load_module
mod = mod._resolve()
File "/usr/lib/python3.7/site-packages/urllib3/packages/six.py", line 113, in _resolve
return _import_module(self.mod)
File "/usr/lib/python3.7/site-packages/urllib3/packages/six.py", line 82, in _import_module
__import__(name)
File "/tmp/.private/sadako/http.py", line 6, in <module>
http = urllib3.PoolManager()
AttributeError: module 'urllib3' has no attribute 'PoolManager'This is the simplest example code giving for both urllib3 and requests packages in their documentation.
Both requests and urllib3 are located in /usr/lib/python3.7/site-packages, and I'm sure I'm using python 3.7, it doesn't seem like it can't find the modules to import in the first place.
I've encountered no such issues using anything included as part of python itself in scripts, just these two 3rd party modules (so far).
So, I'm at a bit of a loss, I'm sure it's something really basic I'm missing or doing wrong, can anyone point anything out?
Thanks.

