python-import Questions
9
It is a similar situation I'd encountered several months ago using pylint prior to pylance:
My python 3.9x - script (using VS Code on Ubuntu 20.04 LTS) starts with the following import of custom &q...
Darcydarda asked 11/12, 2020 at 13:16
23
Solved
I've tried to find a comprehensive guide on whether it is best to use import module or from module import. I've just started with Python and I'm trying to start off with best practices in mind.
Bas...
Louielouis asked 2/4, 2009 at 16:40
1
So, let's imagine I've got a python package of library code with 20 logically-separated modules, and I want to select 1 or 2 classes from each of them for the package's public api. Rather than forc...
Brinker asked 21/2, 2020 at 15:30
2
PyCharm reports 'unresolved reference' to Python imports with docker-compose interpreter running.
see image attached unresolved references e.g. in settings.py:
I have already read and tried some p...
Septal asked 23/9, 2022 at 16:2
1
I added a repo as a submodule to my project, but the import statements inside that repo are not resolving when I compile my project
To add the submodules, I used the command
git submodule add <...
Dramatization asked 13/6, 2018 at 18:23
7
Solved
I'm writing a piece of software over on github. It's basically a tray icon with some extra features. I want to provide a working piece of code without actually having to make the user install what ...
Unicef asked 18/2, 2009 at 21:58
13
Solved
I have a file called tester.py, located on /project.
/project has a subdirectory called lib, with a file called BoxTime.py:
/project/tester.py
/project/lib/BoxTime.py
I want to import BoxTime f...
Coelacanth asked 11/8, 2009 at 14:39
6
Solved
In Python, is it possible to define an alias for an imported module?
For instance:
import a_ridiculously_long_module_name
...so that is has an alias of 'short_name'.
Trinitytrinket asked 1/4, 2009 at 17:33
2
Solved
Python 3.4: From reading some other SO questions it seems that if a moduleName.py file is outside of your current directory, if you want to import it you must add it to the path with sys.path.inser...
Depolymerize asked 26/6, 2014 at 16:26
1
Say that I'm writing a custom PIP package which is structured like so:
.
| setup.py
│
└─── src
| | __init__.py
| | useful_functions_i.py
| | useful_functions_ii.py
| | useful_strings.py
|
└─── test...
Jarodjarosite asked 23/8, 2022 at 14:47
4
Solved
I had a problem with an import of an app in another app in my django project.
I know there are severals question/asnwsers on this subject, and believe me I read a lot of them, even some about pytho...
Chatterer asked 23/7, 2015 at 9:43
7
Solved
I'm working on a documentation (personal) for nested matplotlib (MPL) library, which differs from MPL own provided, by interested submodule packages. I'm writing Python script which I hope will aut...
Lightship asked 3/1, 2012 at 21:29
5
Solved
I am new to Python. This really confused me!
My directory structure is like this:
Project
| - subpackage1
|- a.py
| - subpackage2
|- b.py
| - c.py
When I import a.py into b.py with from...
Engracia asked 24/1, 2019 at 3:50
4
Solved
from ..box_utils import decode, nms
This line is giving error
ImportError: attempted relative import with no known parent package
What is this error and how to resolve this error?
Lombardi asked 10/3, 2019 at 6:11
3
Granted I've been off PYTHON for two + years. I'm trying to get back into the swing, and I remember having command and variable completion available on windows a few years back. We were stuck in 2....
Eurythmics asked 3/7, 2018 at 14:47
3
I am using python 2.7 and I have installed the module websocket-client 0.40.0 but I am getting the attribute error as I mentioned above.
This is my code, I am trying to connect my PC to a microcon...
Autobiographical asked 20/3, 2017 at 14:7
2
Solved
I have some third party library called a and from code examples I learned it has a subpackage b1, i.e.,
from a import b1
Is it possible to see all the subpackages of a? Package a is not pure pyt...
Catcall asked 18/10, 2018 at 15:43
6
Solved
This is my directory structure:
man/
Mans/
man1.py
MansTest/
SoftLib/
Soft/
SoftWork/
manModules.py
Unittests/
man1test.py
man1.py contains the following import statement, which I do no...
Isola asked 8/2, 2019 at 18:29
1
I'm trying to instantiate objects using imported modules. To make these imports process safe (since I'm on windows), I'm using the import statements inside the if __name__ == '__main__': block.
...
Grizel asked 8/2, 2018 at 7:44
3
Solved
I would like to import a submodule without knowing its name beforehand,
>>> __import__("os.path")
<module 'os' from '/usr/lib/python3.3/os.py'>
Doesn't work as you might expect, ...
Garget asked 27/9, 2013 at 6:30
3
I hope the following question is not too long. But otherwise I cannot explain by problem and what I want:
Learned from What is the difference between `sys.meta_path` and `sys.path_hooks` importer o...
Leister asked 1/2, 2017 at 21:33
5
Solved
My employer has a dedicated module1 we use for internal unit / system test; however, the author of this module no longer works here and I have been asked to test some devices with it.
The problem i...
Seta asked 22/6, 2011 at 19:7
2
I want to use a setup.py which imports from a script which is part of the package that has to be installed. This script just contains a dict that contains the strings for creating entry points. I h...
Interleave asked 24/7, 2017 at 12:27
4
Solved
I am currently running a unittest script which successfully passes the various specified test with a nagging ImportWarning message in the console:
...../lib/python3.6/importlib/_bootstrap.py:219: ...
Amytal asked 26/6, 2018 at 14:26
3
I have a project where I want to VS Code's discover tests and other testing features to make testing easier. I have a problem that imports in test files break when I try to discover tests.
I have ...
Galactopoietic asked 30/7, 2019 at 14:22
© 2022 - 2024 — McMap. All rights reserved.