Skip to main content
New: Stack Overflow For Agents. The next generation of knowledge exchange. Learn more
Filter by
Sorted by
Tagged with
Filter by Employee ID
-4 votes
0 answers
117 views

How can I force python to execute the following from X import Y There is a package X that has some init code just orphaned in the file (not wrapped in a function). It's a black box that I cannot ...
Michael Altfield's user avatar
-1 votes
0 answers
102 views

I have a module foo set up like this: └── modules ├── some_other_class │ └── ... └── foo ├── __init__.py ├── base.py ├── data_fields.py └── ...
bqback's user avatar
3 votes
2 answers
117 views

I am getting an error when I use importlib.reload on a dynamic import. The dynamic import succeeds, but an immediately subsequent importlib.reload() fails, complaining there's no parent module. What ...
Jason S's user avatar
1 vote
1 answer
129 views

I develop Python libraries (like this one) inside a (mini)conda environment using: a text editor (VS Code for that matter, but purely as text editor); and a separate zsh terminal (currently on macOS ...
fpavogt's user avatar
3 votes
1 answer
171 views

I have many-to-many connection in my database and trying to make tables with ORM. Now I have 3 tables (one is secondary) class TableA(Base): __tablename__ = "tablea" id: Mapped[int] =...
Николай Купчиков's user avatar
Advice
3 votes
2 replies
42 views

When writing python code in a jupyter notebook, I often have to remember the exact imports for the libraries I'm using or copy pasting them. When using an IDE, you will usually get a red squiggly line ...
Mr. Awesome's user avatar
1 vote
2 answers
83 views

I’m setting up a Django + Channels project and I think I messed up the order. I ran these commands: cd ~ mkdir social_mvp cd social_mvp mkdir socialsite mkdir core mkdir -p core/templates/core mkdir -...
rexyrzi's user avatar
0 votes
1 answer
115 views

The module I am trying to import is part of a project with the structure VIS/ ├── __init__.py └── Objects/ ├── __init__.py └── _Root.py I am trying to import Root from \_Root.py with from VIS....
KarlTheKrazyKat's user avatar
0 votes
1 answer
314 views

I'm running python 3.11.2 in a venv (/home/pi/myenv) on a Raspberry Pi Zero. I installed dash in the venv using pip. When running import dash I get the following error: >>> import dash ...
mgb's user avatar
Advice
1 vote
4 replies
178 views

I have a module (let's name it optional_module) that I want to be imported optionally, as it can be either present or absent. Now I do it this simple way: try: import optional_module except ...
Phant's user avatar
4 votes
2 answers
154 views

My first question is whether the code in main.py is valid? This is main.py: import foo.bar as fb fb() This is foo/__init__.py: from .bar import * # DELETE THIS bar = lambda: print('lambda bar') foo/...
Andrei's user avatar
2 votes
0 answers
217 views

To be clear, I'm not suggesting anyone actually should import pkg.__init__ directly. This is to understand potential pitfalls if someone decides to convert a module-only distribution into a package, ...
dROOOze's user avatar
1 vote
2 answers
81 views

In Python, when an import fails, how can I differentiate between: The module doesn't exist. The module exists, but it tried importing another module that didn't exist. Example # ./first.py try: ...
kviLL's user avatar
-2 votes
1 answer
114 views

I have a very complex Python library that is used by several people/projects for different purposes. The structure is basically the same as many Python libraries, but I would like to give the ability ...
jcfaracco's user avatar
0 votes
0 answers
116 views

I don't manage to make the editable mode pip install -e . for a local installation of my project. After the installation, when I import a constructor from a module of my package within in python shell ...
kouign amann's user avatar

15 30 50 per page
1
2 3 4 5
404