2,091 questions
0
votes
0
answers
24
views
Use importlib.resources.files with no argument
I want to use importlib.resources.files to access a file from a module.
According to the docs,
If the anchor is omitted, the caller’s module is used.
So I would assume something like
import ...
0
votes
1
answer
31
views
ModuleNotFoundError: No module named 'Teacher' in Python when importing from another folder
ModuleNotFoundError: No module named 'Teacher' even though the file exists
I am trying to import a function from one Python file to another, but I keep getting the error:
ModuleNotFoundError: No ...
0
votes
0
answers
24
views
Anaconda Python3 virtual environment unable to recognise local modules
I'm reproducing a project code and trying to execute it locally.
It uses Python 3.6 and old packages dating to 2017 and PIP struggles to install them and returned error codes which were 40 pages long.
...
0
votes
0
answers
50
views
Import Helpers.py from different directory
I am making a React app.
I am using some Python code to automate a few things.
But currently I am duplicating some Python code across separate components. I would like to avoid this, and place all my ...
0
votes
1
answer
33
views
Am I using a "backported module"?
I'm trying to use the Python vermin utility to determine the minimum version needed to run a script of mine. Running it, I get:
$ vermin --no-parse-comments foo.py
Tips:
- You're using potentially ...
0
votes
1
answer
40
views
Python 3 relative imports behave differently between local run and on k8s
I have the following structure:
project/
|- src/
|- __init__.py
|- package/
|- __init__.py
|- module1.py
|- module2.py
Let's say module1.py ...
1
vote
2
answers
44
views
Executing & accessing python module code with __all__ in __init__.py
So I'm trying to write a simple wsgi python module where I use __init__.py to bring in variables & functions from another file but I can't seem to get the module to load. I keep getting the "...
0
votes
0
answers
34
views
Attempting to import sentence_transformers throws `AttributeError: readonly attribute`
When attempting to import sentence_transformers I get this error:
AttributeError: readonly attribute
I'm running Python 3.12.9 in VS Code. I've tried uninstalling and reinstalling ...
0
votes
1
answer
21
views
Not able to use Smartsheet python api when packaging project using Nuitka
I wrote a python project that automates tasks and makes use of the smartsheet api but when I package this project into an executable with nuitka I get the error:
ImportError! Could not load api or ...
0
votes
0
answers
30
views
how to import session manager for python in visual studio
I don't have a session manager module in my system and i try to install it using: pip install session-manager. It shows the error:
ERROR: Could not find a version that satisfies the requirement ...
2
votes
3
answers
81
views
How to "fold" python files used as modules into the main script file?
Suppose I have two Python script files: foo and utils/bar.py in some directory. In foo, I have:
import os
import sys
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
from utils.bar import ...
-1
votes
1
answer
89
views
What is the best way to manually install a python library?
I am currently creating a python library, and I want to find what is the best way for a user to install it on their computer.
It is not distributed on Pypi (or Pypi test) for now, so I want them to ...
0
votes
1
answer
38
views
Docker python not able to recognize custom module
I have a project with the following structure:
project/
checks/
__init__.py
<some files here>
engine/
__init__.py
<some files here>
models/
__init__.py
<...
-1
votes
1
answer
41
views
ModuleNotFoundError when referencing folder in Python [duplicate]
I have a Python3 project arranged as follows:
C:\automation\framework\constants.py
C:\automation\tests\unit-tests\test_myunittest.py
In my unit test, I'm trying to call methods in framework folder, ...
0
votes
1
answer
287
views
Troubleshooting consuming python module in azure function
I have the following code structure in my Python (3.12.3) application:
**ROOT**
-- .venv
-- azure_functions
---- function_app.py
---- host.json
---- local.settings.json
---- requirements.json
-- src
--...