python-module

How to resolve ModuleNotFoundError when importing a local Python file?

How to resolve ModuleNotFoundError when importing a local Python file? Question: I am studying python. I’m trying to do a simple exercise from the course I’m studying. I tried to separate the classes into different files to make it easier to keep track of the inheritance and to be able to update the program in …

Total answers: 1

Pip installs packages in the wrong directory

Pip installs packages in the wrong directory Question: So I want to install the opencv-python package. I typed in pip install opencv-python and got this: Collecting opencv-python Downloading opencv_python-4.7.0.72-cp37-abi3-win_amd64.whl (38.2 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 38.2/38.2 MB 3.1 MB/s eta 0:00:00 Requirement already satisfied: numpy>=1.17.0 in c:usersleo westerburg burrappdatalocalpackagespythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0localcachelocal-packagespython39site-packages (from opencv-python) (1.24.2) Installing collected packages: opencv-python Successfully installed …

Total answers: 2

problem about importing a module into python

problem about importing a module into python Question: 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 want to use it. The error …

Total answers: 1

some problems of using Python's Cryptography on Windows

some problems of using Python's Cryptography on Windows Question: I would like to use the cryptography’s module on Windows, I am using version 1.12 and Python 3.10.6, and I have some problems. Actually, when I run my script, I receive the error : ` Traceback (most recent call last): File "C:/Users/edoua/Documents/cryptographie.py", line 1, in <module> …

Total answers: 1

How do you import a nested package via string?

How do you import a nested package via string? Question: I’m trying to dynamically import a package which is a subdirectory of another package. Though there is no documentation about it, this doesn’t seem to be possible with importlib. Example: Start with pip install pytest then, import importlib mod = importlib.import_module("pytester", package="_pytest") fails with ModuleNotFoundError: …

Total answers: 1

Pyfirmata throws error after creating arduino object

Pyfirmata throws error after creating arduino object Question: I’m trying to start an arduino project but every time I try running it it throws an error. I think I might have gotten some of the setup wrong? I’ve uploaded the Standard Firmata Sketch to the Arduino Mega and installed pyFirmata. I can’t really think of …

Total answers: 1

How can i create timer or contdown in python?

How can i create timer or contdown in python? Question: Is there any function or way that I can greate timer in python? For example:you have 5 seconds to slove this question or maybe to calculate total time for solving this question The simple one countdown: Asked By: Luiza || Source Answers: Here is your …

Total answers: 1

Split AttributeError, "'str' object has no attribute 'spilt'"

Split AttributeError, "'str' object has no attribute 'spilt'" Question: text is shown below, I’ve searched high and low for the solution, but can’t find anything. any help is appreciated import random from aiohttp import request from aiohttp import web from random import randint response = request.__get__(‘https://svnweb.freebsd.org/csrg/share/dict/words?view=co&content-type=text%2Fplain’) r = request.__get__(response) dootdoot = r indivial_words = str(dootdoot).spilt() …

Total answers: 1

Using a python package in the current app and its child package

Using a python package in the current app and its child package Question: I have a FastAPI app that uses package A as a dependency. On every request to the FastAPI app, package A stores some request string in a ContextVar inside the package. The FastAPI app also uses package B. This package B uses …

Total answers: 1