2,086
questions
0
votes
0
answers
9
views
ImportError: DLL load failed while importing onnx_cpp2py_export: A dynamic link library (DLL) initialization routine failed
I'm trying to set up and test the OCR model from the doctr library provided by Mindee
(https://github.com/mindee/doctr)
within a VSCode. I installed the package in run.ipynb using the following ...
1
vote
3
answers
40
views
Vs-code unable to import modules modules load
I'm opening the same python project in pycharm and everything is working well
opening same folder on vs code with same interpreter
I'm getting error 'Unable to import' on local modules in the project
...
-1
votes
0
answers
53
views
Global module variable doesn't change after being imported [duplicate]
I have a function that makes two global variables upon import. Another function turns those variables into IntVars, but it doesn't update them for the code that uses the module.
AliasTkFunctions ...
0
votes
1
answer
46
views
How to prevent `pip install` resulting in duplicate code?
I am working on a library with some others. Our git repo (called modulename) looks like this
modulename/
src_file_1.py
src_file_2.py
tests/
...
.../
The instructions are to clone this somewhere ...
0
votes
0
answers
10
views
i couldn't install any modules in my vs code, what i should do to fix this issue
pip3 install qrcode
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package ...
-1
votes
0
answers
40
views
C extension warning in vscode
I installed a module which I think has written with C for python but in vscode in windows 10 it has this warning for each function of it :
"The C extension is not available. Switching to fallback ...
-1
votes
0
answers
62
views
ModuleNotFoundError: No module named 'matplotlib' and same for statsmodels
Keep encountering the no module named error despite trying everything I could find.
import pandas as pd
import yfinance as yf
from statsmodels.tsa.arima.model import ARIMA
import matplotlib.pyplot as ...
0
votes
1
answer
23
views
"Collecting" classes/variables from various files to simplify importing?
Suppose several classes are defined in multiple different files across a Python project, such as
mylib.somefile.Class1
mylib.somefile.Class2
mylib.anotherfile.Class3
mylib.athirdfile.Class4
...
What ...
0
votes
0
answers
16
views
Python multiprocessing, failed importing modules when running multiprocess from subdirectory
In python when running a multiprocessing process from a subdirectory in the project folder, the process has problem of importing the needed modules from the root directory.
Specifically I am trying to ...
0
votes
1
answer
39
views
Micropython on RP2040, ImportError: no module named 'lcd_module'
I am running MicroPython v1.23.0 on 2024-06-02; Raspberry Pi Pico with RP2040 and I'm trying to import a module that I have written (called lcd_module). However, I keep running into this import error.
...
0
votes
1
answer
27
views
ImportError and SyntaxError in Python Project Structure
Problem Description:
I am working on a Python project with the following structure:
Scriptus
├── frontend
│ ├── hf_call.py
│ ├── slide_deck.py
│ ├── slide_gen.py
│ └── ui.py
├── ...
0
votes
1
answer
34
views
I wrote the code for this analog clock, but I don't know why place of the numbers are not correct
import pygame
from math import radians, sin, cos
from datetime import datetime
class Clock:
def __init__(self):
self.width, self.height = 800, 800
self.white = (255, 255, 255)
...
0
votes
1
answer
57
views
AttributeError: property 'mode' of 'JpegImageFile' object has no setter
I'm getting an error:
AttributeError: property 'mode' of 'JpegImageFile' object has no setter
While trying to open an image using the Pillow library.
My code:
from pil import Image as pl
my_img = pl....
1
vote
0
answers
936
views
ModuleNotFoundError: No module named 'paramiko.auth_strategy' while using fab2 python
I'm trying to execute a python task using fab. I've installed fab2 for python3 and trying to use it to run the task in a venv. Unfortunately using fab2 keeps giving me this error:
(venv) My-MacBook-...
1
vote
1
answer
163
views
What is the difference between installing a module with pip/setup.py vs adding it to PYTHONPATH?
I have a custom Python module I want to use in another project. This module gets deployed to production as well. I have two options:
Add a setup.py and install the module locally with pip.
Add the ...
0
votes
0
answers
84
views
How to inspect Python file/module information without using `__file__` — perhaps in a module-level `__getattr__(…)` function?
I have a utility package for Python projects I maintain and use. It’s a bundle of lightweight, common, junk-drawer tools (e.g. command parsing, app lifecycle management, document generation, &c &...
0
votes
0
answers
26
views
Does Zscaler has api endpoints to Backup configurations?
Does Zscaler has exposed api endpoints to backup configuration or any python library available to backup configuration settings ?
I have the documentation of common endpoints which zscaler has exposed ...
0
votes
1
answer
47
views
Why is my Tkinter image failing to load / be retained when the active file is not __main__?
I am developing a Python application using Tkinter. I have created a module which is essentially a modal to be called elsewhere in the application - in the same file I check if name is main, and I ...
2
votes
1
answer
75
views
Is it possible to use the same Django application name in multiple locations within a project?
I have a similar project structure to one below.
project_name/
│
├── apps/
│ ├── items/
│ │ ├── purchases/
│ │ │ ├── migrations/
│ │ │ ├── templates/
│ │ │ ├── __init__.py
│ │...
-3
votes
1
answer
88
views
python module install stuff
whenever i try to use python module install in the shell (im trying to use the command "python -m pip install pygame") and whenever i try to it says "Python was not found; run without ...
1
vote
2
answers
74
views
Python issue with importing from submodule including scripts that also import from submodule?
My Python project has the following file structure.
module/
├── __init__.py
├── main.py
│
└── sub_module/
├── __init__.py
├── foo1.py
└── foo2.py
My goal is to import a class Bar from ...
1
vote
2
answers
105
views
Use Pybind11 library created with MSYS2,CMake and Make in Python
I have just created a library with Pybind11 from the C++ side:
I did it with MSYS2 and CMake and Make. (I have GCC, Make, CMake and Pybind11 installed with the commands)
pacman -S mingw-w64-x86_64-gcc
...
0
votes
1
answer
48
views
Importing a folder that has same name as a package
Let say I have a folder Pkg1, and a library also called Pkg1 (installed elsewhere) on the computer.
I also have a file run.py at Pkg1 > scripts > run.py.
I want to do:
from Pkg1 import Function1
...
0
votes
0
answers
29
views
Can't install/find modules via Python code (while compiled)
I have a Python script that when ran in the ide and/or as a .py file in general, it works just fine. All the modules are found and imported properly. Then the issue arose, for some reason when I ...
0
votes
1
answer
84
views
Programming newbie - How can I fix an python import module error? [closed]
I'm using an old version of Python (v3.2) on a USB standalone environment (Portable Python) for simplicity and educational purposes since it works virtually on any computer without any software ...
0
votes
2
answers
300
views
Pyinstaller: Exe throws ModuleNotFoundError: No module named '...'
I'm a new programmer (6 month) and use this forum for the first time. So please allow me missing information and incorrect entries.
I wrote my own logging package, and like to import it into another ...
0
votes
0
answers
22
views
How to deal with error when pybind11 setuptools building
I am using pybind11 setuptools to build a python module(.pyd), but an error occurred:
executing :error: command 'C:\Program Files\Microsoft Visual
Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\...
0
votes
1
answer
88
views
How to set up DJANGO_SETTINGS_MODULE with absolute path of the settings.py file
I need to write some scripts for django and trying to set up the DJANGO_SETTINGS_MODULE environment variable at the beginning of each script. The scripts, manage.py and myproject directory are in the ...
0
votes
0
answers
23
views
Absolute import to access a python module in a directory above
I have the above file structure. Within src/jobs there is a file common.py which has code that will be reused across all the different jobs. Each job will be in a separate sub-directory. I want to ...
-2
votes
1
answer
77
views
I have a problem running python code in vs terminal
Unable to find python module. it prints that multiple times
I tried to download the same version of my vs python which is 3.11.7 in my terminal by using the command pip install python 3.11.7 but it ...
0
votes
0
answers
13
views
Visual Studio Code cannot find one of my modules, but cmd can find it without issue using the same methods
When using a venv I cannot find my neat module. This image shows that I have installed the module, have selected the right venv and it still doesn't work. This image shows that attempting the same in ...
2
votes
1
answer
77
views
File size overhead reduction of C++ wrapping by Cythonization
I have the following minimal example of summing an array (taken from here):
#lib.cpp
template<typename T>
T arr_sum(T *arr, int size)
{
T temp=0;
for (int i=0; i != size; ++i){
...
0
votes
1
answer
51
views
Directly import modules in a Poetry project from a non-Poetry managed module
I have an existing codebase that I am working in, and for any new code, I am using Poetry to manage the modules, dependencies, etc. For existing code, I am slowly migrating over code, but this is ...
2
votes
2
answers
287
views
Python module with name __main__.py doesn't run while imported
Somebody asked me a question and I honestly didn't try it before, So it was interesting to know what exactly happens when we name a module __main__.py. So I named a module __main__.py, imported it in ...
0
votes
1
answer
225
views
How to import Python module into a Python script in Glue AWS
I have a project with this structure:
└── external_variables
├── anatel_access_data linux.py
├── anatel_access_data.py
├── bsria_variables.py
├── future_external_variables.py
├── ...
0
votes
0
answers
48
views
Python ModuleNotFoundError for command line tools built with setup.py
I am trying to build a simple command line tool and package it with setup.py. Here's my directory structure.
├── s3_md5
│ ├── __init__.py
│ ├── cmd.py
│ └── src
│ ├── __init__.py
│ ├─...
0
votes
0
answers
29
views
Import local modules in Python with relative path
TopLevelDir
├── CommonUtils
│ ├── setup.py
│ └── Sql
│ ├── class1.py
│ └── class2.py
├── Project1
│ ├── requirements.txt
│ ├── venv
│ ├── main.py
│ └── FolderA
│ ├── ...
0
votes
0
answers
59
views
Problems with transitive imports in Python3 [duplicate]
I'm having a problem with some (likely badly-written) Python2 code, which I'm trying to convert to Python3. I'm sure this has been answered somewhere else before, but my Google-fu is not up to this ...
2
votes
1
answer
40
views
PyGame - functions in other files are not defined
Been making my first PyGame project and previously after clicking on "start game" button it would take user to the gameplay window, whereas now it claims gameplay is undefined. I have tried ...
0
votes
0
answers
80
views
Error in import module Flask application deploy in vercel using vercel.json
I'm encountering an issue while attempting to deploy my Flask application to Vercel using a vercel.json file. My application consists of a main.py file where the application is initialized. This file ...
0
votes
0
answers
25
views
imported python module of functions does not recognise package imports
I have files in a repo with the following Structure:
RepoName\main.py
RepoName\functions\myfunction.py
Inside myfunction.py is:
import pandas as pd
def make_ticker_list():
constituents = pd....
0
votes
2
answers
119
views
How do I reload a python module?
This has been asked 1000 times before, but nothing seems to work for me.
Using Python3.9 and VScode, though I have tested it making edits with just the plain TextEdit app on mac as well.
I cloned this ...
0
votes
1
answer
126
views
Python isn't recognizing my speech to text in a way I can use it in if statements
I'm currently building a personal assistant using python, and I got it to work to a certain extent. I have been using this video tutorial. I am getting the assistant "harvey" to say all ...
2
votes
2
answers
2k
views
How do I troubleshoot "ModuleNotFound" errors
I often run into issues where my own modules are not found in python, and while I've been addressing them on a case-by-case basis, I don't really feel like I know how to actually troubleshoot them. It ...
0
votes
2
answers
213
views
No module named 'whois' Despite Already Installing 'python-whois'
Context
I am making a project using Python and have a virtual environment installed called venv. Here is the information for the virtual environment:
Version and Modules Installed:
I am on a linux ...
0
votes
1
answer
146
views
How to check if a Python module with a custom __getattr__ has a given attribute?
I implemented a custom __getattr__ on a module that retrieves a value and caches it with setattr. Here is the simplified version:
# mymodule.py
import sys
__this = sys.modules[__name__]
def ...
0
votes
2
answers
49
views
Unable to install any modules with Pip and this error
enter image description here
I have installed python on my windows laptop appropriately but am unable to use or execute many things due to this kind of error. How do I come out of the shell and ...
0
votes
1
answer
71
views
How to import a Python class from a directory which has dependency in the same directory?
I want to use a class A, which is in a subdirectory dir in file A.py. It has dependency with file B.py which is also in the same directory dir. I want to use the A class from its parent directory. The ...
1
vote
2
answers
76
views
Python ModuleNotFoundError only in command line execution not in IDE
I see a ModuleNotFoundError error when running a simple program.
The project is created using Poetry, and the setup is as shown in the screenshot.
h.py has this:
def add(num1, num2):
return num1 +...
1
vote
1
answer
91
views
python import functions in multiple files from top level folder
I have a directory structure that looks like the following;
file.py
module1/
__init__.py
module1_file1.py
module1_file2.py
Lets say module1_file1.py has a function foo and module1_file2....