2,084 questions
0
votes
1
answer
45
views
Why does Inheritance polymorphism works depending on how we import in python
Consider these three files:
base.py
class Base():
def method(self):
print('Base Class')
object = Base()
main.py
from base import object
def main():
object.method()
if __name__ == '...
0
votes
1
answer
143
views
Kivy Won't download with pip
I can't get Kivy to install with pip.
This is what I wrote in command prompt
C:\Users\user\Desktop\Test>python -m pip install kivy[full]
Collecting kivy[full]
Using cached Kivy-2.1.0.tar.gz (23.8 ...
0
votes
0
answers
147
views
Error while trying to install python modules using pip [duplicate]
I'm getting these warning and errors
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: ...
1
vote
2
answers
519
views
How importing packages and subpackages actually work?
I've been trying to understand how importing packages and subpackages works in Python. Based on what I understood from realpython.com, a package is simply a directory that contains python modules and ...
2
votes
0
answers
91
views
how Manim execute a package project?
I am currently working with manim, I have structured my project in the form of a package
Directory where the project is located
when trying to run any file I usually do it with
the command
python -m ...
0
votes
1
answer
168
views
ModuleNotFound Error When I Supply Path on Python
Below is my file setup:
|-Desktop
|--Python Projects
|---Senior Project
|----pyspectra-master
|-----pyspectra-master
|------pyspectra
My goal is to import libraries from pyspectra into Jupyter ...
-1
votes
1
answer
246
views
My external python modules are not showing up because python isn't in Path, how do I relocate them?
I am fairly new to python, I would like advice on how to move python into Path. Currently, when I run pip install keyboard, the "Requirement already satisfied" shows up. I am using Visual ...
0
votes
1
answer
780
views
import a python package ( which is a docker container) in python script
I am running a python script in a conda enviroment (I have to do this on the HPC). one of the packages (called scrublet) that I need to import in the python script could not be installed using pip or ...
0
votes
1
answer
47
views
packages / import statment
I have virtual environment package structured as following:
apps/
__init__.py
main_app.py (storing the execution function)
st/
speedtest.py
__init__.py
quota/
...
0
votes
0
answers
158
views
Python module referencing issue
I have the below directory structure:
src/
--check.py
--quantum/
----__init__.py
----ansatz.py
----hva/
------__init__.py
------single_layer_hva.py
In my check.py, I'm doing the below:
#check.py
...
1
vote
0
answers
593
views
How to import modules from parent subdirs properly (Pylint E0401: Unable to import (import-error))
For this question I created simplified structure of my another project to recreate the problem, yet to make it simpler for you to understand.
Structure of project
project_directory
├─── package_one
│ ...
0
votes
0
answers
179
views
no module named src
I want to dockerize the following application, however, for some reason, I can't run it in docker, but it works on my local machine, the file structure goes as follows
Dockerfile
requirements.txt
src
├...
2
votes
3
answers
4k
views
ModuleNotFoundError when import package from src folder
What is wrong with this python structure?
I have read multiple docs and forums on this issue i just can't seem to get it solved.
.
└── src
├── __init__.py
├── lib
│ ├── hello.py
│ └...
0
votes
1
answer
541
views
Trouble deploying telegram bot on Render
I am trying to deploy this telegram bot on Render, but the deploy always fails (although on the first minutes after I receive the build successful log, it works perfectly).
However, minutes later the ...
0
votes
0
answers
44
views
Python: forcing imported string interpolation for SPARQL (not SQL) [duplicate]
I use f-strings to build SPARQL queries with a variable and they work well as follows:
for label in longnames:
sparqlquery = f"""
PREFIX osr:<http://dati.senato.it/osr/>
...
0
votes
1
answer
253
views
problem about importing a module into python
I am working on packets in my linux iptable , so i need to work over them in python. To get the packets in my iptable into python , i decided to use netfilterqueue.However , i run into error when i ...
0
votes
0
answers
25
views
Detecting python modules from different directories in my project structure
I have a project structure in VSCode like this:
Project/
.venv/
virtual environment containing pip packages like numpy
config/
__init__.py
useful scripts
src/
program.py
I want ...
0
votes
0
answers
37
views
Check if more imports are installed and install missing only python
I wonder if there is a way to check if all modules I am importing in the script are already installed and if some are not installed to install it.
For example,
import encodings
import json as json
...
-6
votes
1
answer
118
views
Python Module error even though init file kept [closed]
I am not sure what to do here.
The below image shows the heirarchy.
I tried init file in the code.
Kept main.py (not using it) in the parent folder
0
votes
1
answer
239
views
Import *local python file* could not be resolved
I'm trying to import a python script (called flask_router.py) from the same directory into another python script (import_requests.py) but am receiving the following ModuleNotFound error in both the ...
0
votes
0
answers
37
views
How do I get the variable and get it to sort the numbers and print how many passed?
I am somewhat new coding, and tried to make a "macro" of sorts to roll a large amount of dice, and show how many hit, and while I have not got to it yet, apply a modifier if x number was ...
0
votes
1
answer
84
views
how to debug python modules while developing
Let's say we are developing a simple python module with the following directory structure
.
├── module
│ ├── __init__.py
│ ├── core.py
│ └── helpers.py
└── test.py
contents of init.py
#!/usr/...
1
vote
1
answer
56
views
Python Package with inter-Modul Dependencies
My Folder Structure looks like the following
person-package
|- __init__.py
|- person.py
|- person_manager.py
main.py
person_manager.py imports person.py
import person as x
The main.py imports ...
1
vote
1
answer
243
views
Is there an alternative to the command line "python -m module app ..." that works inside Python code?
For example I'm downloading a model for spaCy using the command:
python -m spacy download en_core_web_sm
Is there an acceptable way to access this functionality within Python, something like:
import ...
1
vote
0
answers
103
views
Background importing of slow python module
I have a python module (odoo.py) that creates a connection with an Odoo instance.
import odoorpc
from .env import ENV
ODOO = odoorpc.ODOO(ENV["ODOO_HOST"], port=ENV["ODOO_PORT"])
...