Importing test libraries failed. No module named 'a' - python

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

Related

Getting ModuleNotFound error while importing from same subdirectory

Unable to import str from a module in the same directory.
Project is structured like this:
parent
└───cmds
└───chat_client.py
auth_client.py
In chat_client.py when I try to from cmds.auth_client import sesuser I get ModuleNotFoundError: No module named 'cmds'.
I tried removing the cmds. part, however instead it just gave me ImportError: cannot import name 'sesuser' from 'auth_client' (e:\parent\cmds\auth_client.py).
from auth_client import sesuser
try removing extention '.py'

How to modify imported files in python

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

No module named zope.index

Getting the following error when trying to import a lib that depends on zope
No module named zope.index
my python path is correct (I can import other libs)
I already created an init.py file in the zope folder but it still isnt working so Im not sure what I might be missing
currently using python 3.7
*edit
Error:
File "C:\Users\vitor.valentim\AppData\Local\Programs\Python\Python37\Lib\dedupe\tfidf.py", line 5, in
from .canopy_index import CanopyIndex
File "C:\Users\vitor.valentim\AppData\Local\Programs\Python\Python37\Lib\dedupe\canopy_index.py", line 3, in
from zope.index.text.lexicon import Lexicon
ModuleNotFoundError: No module named 'zope.index'
zope path
zope.index path
The error message No module named zope.index implies that import found a package zope, but then failed to find zope.index (otherwise the error message would be No module named zope).
Try
import zope
print(zope)
and see what that resolves to, something like this often happens if there is something shadowing the package you're trying to import.

Getting import error saying there is no module

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

ImportError: No module named X, even if folder is in the same directory

I've downloaded pymumble from https://github.com/Robert904/pymumble and saved it to my working directory. I import it with:
from pymumble import pymumble
However, I receive:
ImportError: No module named pymumble
I'm looking at similar code that does this successfully. What am I doing wrong when trying to import this?
As I can see there is no file called pymumble in given repository, if you are looking for this there is a file called mumble.py, try importing
from mumble import mumble
this will work.

Categories

Resources