Category "python-import"

Python3 importing files from parent directory / relative importing

I have the following file structure: parentfolder/ utils.py myProgram/ main.py other.py I will be running the main.py which utilizes other.py

Python terminal closes when importing BeautifulSoup

I have a simple python program, that is supposed to scrape some information from the internet and do stuff with it. When I run the code in PyCharm (IDE) it work

python import socket class from other modules

I have created a class(object) connection_manager using socket TCP in a module (connection.py): #file connection.py HOST = "127.0.0.1" # Standard loopback inte

Import functions that use ipython magic

In ipython cells you can execute shell commands as follows: ipython: print("asdf") !echo asdf However, if you try to import this code from file, asdf.py: def a

ImportError: No module named solcx

I installed py-solc-x via pip3 install py-solc-x in the terminal but when I run the program, I still get an importerror. What's going on here? My code: from sol

Unique import * only allowed at module level

I am making a utility program which has multiple programs built into it but I made some changes to my program for it re-run when the user has prompted which the

can't import function from different module/file

I'm super new to this and this is my first time posting on forum.. trying to import a function from books.py to be used in logic.py File structure: application

how to import boto3 athena client exceptions

I am working with athena from within my python code, using boto3, as follows: def query_athena(query, output_path): client = boto3.client('athena') clie

`UnencryptedCookieSessionFactoryConfig` error when importing Apex

I'm trying to use Apex and whenever I try to import it (or anything involving it) I get the following traceback: Traceback (most recent call last): File "<

How to solve (NaN error) when given column specific name

I have many text files include data as follow: 350.0 2.1021 0.0000 1.4769 0.0000 357.0 2.0970 0.0000 1.4758 0.0000 364.0 2.0920 0.0000

How to solve (NaN error) when given column specific name

I have many text files include data as follow: 350.0 2.1021 0.0000 1.4769 0.0000 357.0 2.0970 0.0000 1.4758 0.0000 364.0 2.0920 0.0000

'Import "Path.to.own.script" could not be resolved Pylance (reportMissingImports)' in VS Code using Python 3.x on Ubuntu 20.04 LTS

It is a similar situation I'd encountered several months ago using pylint prior to pylance: My python 3.9x - script (using VS Code on Ubuntu 20.04 LTS) starts w

Python opencv Aruco "No module named 'cv2.aruco'"

I am running an Ubuntu virtual machine with, Python 3.6.1, Anaconda 4.4.0 (64-bit). I am trying to run the code on this website. When I try to use import cv2

Module not recognising root directory for Python imports

I have a Python project that uses the MicroKernel pattern where I want each of the modules to be completely independent. I import each of the modules into the k

Builtin python's __import__ vs imp.load_module: ValueError: Attempted relative import beyond toplevel package

I have a piece of code that dynamically imports a bunch of subpackages - package structure: main_package/ code_below_is_here.py game/ __init__.p

3 level chained python import is failing

I have the following folder structure across 3 levels: folder1 contains folder1_1 which again contains folder1_1_1. Now we have a .py file in each folder (besid

ModuleNotFoundError when importing Pygame after pip install Pygame

I was trying to make a simple snake game in Python so I installed Pygame using pip install Pygame. After I installed it successfully, I tried importing Pygame b

How to import a module from a different folder?

I have a project which I want to structure like this: myproject ├── api │ ├── __init__.py │ └─&#

How to programmatically add root folder to the path for every script?

The file structure I currently have is something like: __init__.py script_folder __init__.py s1.py s2.py b_folder __init__.py b1.py b2.p

Python circular imports with inheritance

I have a parent and child class, where a parent's method returns an instance of the child. Both classes are in separate files classA.py and classB.py. In order