When I am trying to run a compiled Python executable, I am running into a weird problem with the requests module.
The exact Error message is as follows:
File "tradingbot.py", line 11, in init tradingbot
File "C:\Users\igors\Downloads\olympian_(4)\bin3\lib\site-packages\requests\__init__.py", line 60, in <module>
from .packages.urllib3.exceptions import DependencyWarning
File "C:\Users\igors\Downloads\olympian_(4)\bin3\lib\site-packages\requests\packages\__init__.py", line 29, in <module>
import urllib3
ImportError: No module named urllib3
As you can see, __init__.py
file cannot import urllib3 module.
After following the path, we see the following directory:
After that, I decided to look into __init__.py
, and found the following import code:
try:
from . import urllib3
except ImportError:
import urllib3
sys.modules['%s.urllib3' % __name__] = urllib3
As you can see, the line that Error message refers to is import urllib3
.
The problem is, why the program struggles with finding a folder containing the urllib3 module which is clearly located in the same directory as init file?
Please keep in mind that the program should work without having Python or any other libraries pre-installed on the user's PC. It should collect all the files from its own resources.
PS People asked me to show the urllib3 folder contents, so here it is:
Probably int the urllib3 folder there is a .py file you need to import. Or you can just import everything at once. You can do those things respectively like this:
import urllib3.[file you want to import]
from urllib3 import *
usually python module should contain __init__.py
itself
could you provide more information on what your urllib3
folder contains?
as well, you could try to take a look at https://docs.python.org/3/library/venv.html or https://www.docker.com/ if you don't want to install anything in pc
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.