I'm slowly despairing of Python import module
-Cloned binance_f from github and installed with setup.py.
-Modification in files don't show up --> I searched and found:
import importlib
importlib.reload(module)
Then I get an error message:
> importlib.reload(binance_f)
> NameError: name 'binance_f' is not defined
The problem might be the "from" statement:
from binance_f import RequestClient
from binance_f.model import *
from binance_f.constant.test import *
from binance_f.base.printobject import *
import importlib
importlib.reload(binance_f)
If I don't execute the setup.py I get the follwoing error:
> from binance_f import RequestClient
> ModuleNotFoundError: No module named 'binance_f'
How can that issue be resolved? Is there any way to "globally" reload other modules? I mean, what are you doing if you clone a github repository but can not change the files?
Best regards
Related
Hi I'm using ebooklib in python and I'm getting this error
ModuleNotFoundError: No module named 'ebooklib'
I have successfully installed this library and it appears in my pip3 packages list.
I'm importing this in my python file like this
import os
import logging
import sys
import json
import traceback
from ast import literal_eval
from htmlparse import MyHTMLParser
from ebooklib import epub
I don't know what's wrong.
I had the same issue & fixed it by adding:
> export PYTHONPATH="/usr/local/lib/python3.8/site-packages:$PYTHONPATH"
to my .bash_profile file.
To see where your ebooklib is installed to
print(ebooklib.__file__)
I have a folder /example which contains /Libs which further contains different folders /a, /b each containing python libraries. I am trying to run a robot framework code from /example.
The error it shows :
Importing test library 'a' failed: ImportError: No module named 'a'
File "/root/Libs/a/init.py", line 7, in
from a import a_classname
How can I solve this?
import os
import sys
filepath = "path/file/"
sys.path.append(os.path.abspath(filepath))
from a import a_classname
I have recently installed a library using this code:
pip install scikit-commpy
Moreover, I downloaded the tar.gz file from this site: https://pypi.org/project/scikit-commpy/#files and launch the setup.py file, but when I do this on python to check the installation:
import commpy
It gives me the following error:
File "C:\ProgramData\Anaconda3\lib\site-packages\commpy\__init__.py", line 17, in <module>
from filters import *
ModuleNotFoundError: No module named 'filters'
So it looks like the __init__.py file in that directory has broken imports somehow. I was able to fix it in vim by changing the import to:
init.py
from .filters import *
from .modulation import *
from .impairments import *
from .sequences import *
I'm not sure how that will impact other functionalities in the module, but that does allow me to run
import commpy
with no errors.
NOTE
It appears this behavior is further down in the module as well, so if you were to attempt
from commpy import channelcoding
it will raise similar exceptions. So you will have to do more surgery on the module in ./commpy/channelcoding/__init__.py:
from .convcode import Trellis, conv_encode, viterbi_decode
from .interleavers import *
from .turbo import turbo_encode, map_decode, turbo_decode
from .ldpc import ldpc_decode
from .gfields import *
from .algcode import *
Upon further inspection, the syntax of this library is python2
I want to import a color module but I am getting the error:
ImportError: No module named 'scripts.UltraColor'
Import code:
from scripts.UltraColor import *
The import code is in pygameTest.py
The problem here, as far as I can see on that screenshot is UltraColor file doesn't have the .py extension, for import to work properly you'll need to rename it from UltraColor to UltraColor.py, otherwise will raise an ImportError exception.
For more information, take a look to this one. Import a python module without the .py extension
From azure.mgmt.network.operations import NetworkSecurityGroupsOperations
ImportError: No module named operations
Error in importing submodule operations from this package
Version of the package is: azure-Mgmt-network==2.0.0 rc2
You can use code like below to import NetworkSecurityGroupsOperations:
from azure.mgmt.network.v2017_09_01.operations.network_security_groups_operations import NetworkSecurityGroupsOperations
You can get more details with this link and you can change the v2017_09_01 with which version you need.