Skip to main content
Filter by
Sorted by
Tagged with
1 vote
0 answers
159 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
  • 4,194
-2 votes
1 answer
86 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
  • 880
0 votes
2 answers
160 views

I am trying to put in my Bash script a one-liner that would print my python's path python -c 'import sys; for p in sys.path: print(p)' the for keyword is flagged as an invalid syntax I was expecting ...
Paweł Wójcik's user avatar
-3 votes
1 answer
81 views

I've got the following project tree: SomeDir |- script.py |- TestDir | |- test.py script.py is designed to be called in CLI and contains several classes: notably one that does the actual job and one ...
Oersted's user avatar
  • 3,732
2 votes
1 answer
104 views

I'm implementing my own Python module package, called jbpy. I'm using setuptools with a pyproject.toml file as the build system. I'm working on Ubuntu 24.04, but I also get the error under WSL on a ...
Jens Bang's user avatar
0 votes
1 answer
102 views

I want to load a file from my python module using importlib.resources (see also this question). If the file is inside a submodule, this is straight forward (run using python -m, see here): import ...
502E532E's user avatar
  • 581
0 votes
1 answer
133 views

How to build a python project into a single executable if it has files split in multiple directories? This is my project structure: ├── main.py ├── main.spec ├── src/ │ ├── GUI/ │ │ ├── ...
HappyLemon's user avatar
0 votes
0 answers
87 views

I'm working on a Pycord bot project, and I'm using Nuitka to compile it. My goal is to compile the main script as a single file (--onefile) for distribution, but still be able to dynamically load ...
Kh4lid MD's user avatar
  • 135
0 votes
0 answers
46 views

I created a folder named collections, inside I defined some collections-related modules. When I went to used them, I got an ModuleNotFoundError. Changing the name of collections to my_collections ...
DrStein's user avatar
  • 85
1 vote
0 answers
220 views

With VSCode Pylance, many import suggestions are missing when working under these conditions: Package installed in editable mode I'm working in a separate directory Original package does not contain ...
conjuncts's user avatar
2 votes
1 answer
66 views

The document of Python's import system tells that there are 3 default finders/importers (built-in, frozen, and the import path one). But when trying to get the repr of sys.meta_path, I got another ...
Phuturesh's user avatar
1 vote
0 answers
75 views

I created a test project with the root directory named test_import to reproduce the problem. When I ran the following code to print the sys.path list: import sys for path in sys.path: print(path) ...
zhaomo zhu's user avatar
0 votes
0 answers
69 views

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 ...
nbofni's user avatar
  • 47
-2 votes
1 answer
123 views

Is it possible to declare a global variable that is invisible to the importing script? For example, in script a.py I have a variable var_a that is accessible to any function in a.py. However, in ...
ysap's user avatar
  • 8,241
0 votes
0 answers
33 views

I have a git repo, core, which I would like to use as a submodule within other git repos, e.g. example. core contains python files within which are classes that I would like to import into example. I ...
Jenny's user avatar
  • 1
0 votes
3 answers
164 views

I understand that in Python, relative imports are only allowed inside of packages. Personally, I find this functionality great; it makes it very easy to import stuff from other modules. However, for ...
Frotaur's user avatar
  • 131
0 votes
1 answer
97 views

I want to incorporate an instabot in my code. I downloaded Instabot and installed it through the Windows' command prompt pip install -U instabot as Spyder didn't recognize my user: C:\Users\(My Name) ...
lynou-cats's user avatar
1 vote
1 answer
115 views

I was reading through the python docs for how import is resolved and found this ... the interpreter first searches for a built-in module with that name. These module names are listed in sys....
Dhruv's user avatar
  • 597
0 votes
0 answers
56 views

I'm writing a resource mining game at the moment, and I want players to be able to easily add "expansions" to the game which add on more resources or mechanics. I have a structure that looks ...
DeadlySloth's user avatar
1 vote
2 answers
116 views

I am writing a QGIS plugin. During early development, I wrote and tested the Qt GUI application independently of QGIS. I made use of absolute imports, and everything worked fine. Then, I had to adapt ...
skytwosea's user avatar
  • 409
-1 votes
1 answer
81 views

I have this entry point: # main.py from 022 import * print("Hello from main.py") I have 022.py also. It is: print("Hello World") When I run main.py I get this error: File &...
nicomp's user avatar
  • 4,741
0 votes
1 answer
188 views

I have the following folder structure in python: my_project/ ├── Dockerfile ├── Makefile ├── run.py ├── data/ │ ├── raw/ │ └── processed/ └── src/ ├── __init__.py ├── config.py ├── ...
vossi's user avatar
  • 143
0 votes
1 answer
40 views

I have a Python project with the following structure: ├── main.py ├── pack1 │ ├── __init__.py │ ├── mod1 │ │ ├── __init__.py │ │ └── request.py │ ├── mod1.py │ └── mod2.py The content ...
Wayne Hong's user avatar
4 votes
0 answers
38 views

I'm trying to get GridDB working on my WSL/Ubuntu environment. I have followed https://pypi.org/project/griddb-python/ to install griddb and was successful but when trying to import the module I'm ...
Luke Summerville's user avatar
0 votes
0 answers
45 views

I am using the CPU version of PyTorch and need to spawn multiple processes with it. However, whenever I do import torch, a large chunk of memory is consumed (roughly 200 MB as of PyTorch 2.4.0+cpu). ...
Bojian Zheng's user avatar
  • 2,957

1
2 3 4 5
122