Movatterモバイル変換


[0]ホーム

URL:


Sorry, we no longer support your browser
Please upgrade toMicrosoft Edge,Google Chrome, orFirefox. Learn more about ourbrowser support.
Skip to main content
Stack Overflow
  1. About
  2. For Teams
Loading…
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives
6,060 questions
Filter by
Sorted by
Tagged with
Advice
1vote
4replies
52views

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_moduleexcept ...
Phant's user avatar
4votes
2answers
140views

My first question is whether the code in main.py is valid?This is main.py:import foo.bar as fbfb()This is foo/__init__.py:from .bar import * # DELETE THISbar = lambda: print('lambda bar')foo/...
Andrei's user avatar
1vote
0answers
162views

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, ...
1vote
2answers
63views

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.pytry: ...
-2votes
1answer
87views

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 ...
0votes
0answers
97views

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 ...
0votes
2answers
161views

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

I want to generate a schema based on a class defined in another file, so i need to know the return type of these functions. However, the annotation might be based on some imports under TYPE_CHECKING....
XXXHHHH's user avatar
-3votes
1answer
82views

I've got the following project tree:SomeDir|- script.py|- TestDir| |- test.pyscript.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,834
6votes
1answer
219views

I find myself mixing both import x and from x import y forms for the same module, depending how often a particular object is used and whether it is clear which modules it comes from.For example I ...
Dominik Kaszewski's user avatar
2votes
1answer
108views

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 ...
1vote
0answers
77views

Since os is a module instead of a package, import os.path should fail. For comparison:>>> import os.sysTraceback (most recent call last): File "<python-input-0>", line 1, ...
0votes
1answer
105views

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 ...
1vote
2answers
95views

I'm currently working on a modular python framework. The current dilemma is, that one module has a set of submodules that have vastly different dependencies, and a user usually would only use one of ...
0votes
1answer
138views

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/│ │ ├── ...

153050per page
1
2345
404

Hot Network Questions

more hot questions
Newest python-import questions feed

[8]ページ先頭

©2009-2025 Movatter.jp