import

Is it possible to import a folder as a module?

Is it possible to import a folder as a module? Question: I have a library I’m working on that is intended to be imported like import raycekar as rk and have its individual files referenced as rk.unit.whatever. This is the directory structure: RayceKar |-raycekar | |-__init__.py | |-ui.py | |-env.py `-main.py From within main.py, if …

Total answers: 1

Resource punkt not found. Please use the NLTK Downloader to obtain the resource: >>> import nltk >>> nltk.download('punkt')

Resource punkt not found. Please use the NLTK Downloader to obtain the resource: >>> import nltk >>> nltk.download('punkt') Question: I have NLTK installed and it is going me error Resource punkt not found. Please use the NLTK Downloader to obtain the resource: import nltk nltk.download(‘punkt’) For more information see: https://www.nltk.org/data.html Attempted to load tokenizers/punkt/PY3/english.pickle Searched …

Total answers: 4

How can I resolve import errors?

How can I resolve import errors? Question: pip install easyAI from easyAI import TwoPlayersGame, id_solve, Human_Player, AI_Player from easyAI.AI import TT ImportError: cannot import name ‘TwoPlayersGame’ from ‘easyAI’ (/usr/local/lib/python3.7/dist-packages/easyAI/__init__.py) Asked By: sseop || Source Answers: If you have pip installed, you can type this in a terminal sudo pip install easyAI. Otherwise, download the source …

Total answers: 2

Module not found error when file exists in same directory

Module not found error when file exists in same directory Question: I am running python 3-32 bits on my windows computer. And here is my directory structure: device_controller device_controller.py kestrel_main.py And in the device_controller.py file, I have the import line as so: from kestrel_main import mainKestrel And I do have a mainKestrel() function defined in …

Total answers: 1

SO module found by Cython not found by Python3

SO module found by Cython not found by Python3 Question: I have a simple pyx file: $ cat helloworld.pyx print("hello world in pyx file to be converted to so file by cython.") I have created an .so module using Cython. The directory contains following files: $ ls -ltrh total 140K -rw-r–r– 1 cardio cardio 177 …

Total answers: 1

import matplotlib.pyplot hangs on ubuntu

import matplotlib.pyplot hangs on ubuntu Question: I am using a Python3 installation in a Ubuntu distribution in WSL2 on a Windows 10 machine. Over the last two months, i did not code that much. Now i started again and faced the following issue: The following code hangs for ~2min: import matplotlib.pyplot After 2 min, i …

Total answers: 1

How can I import a csv from another folder in python?

How can I import a csv from another folder in python? Question: I have a script in python, I want to import a csv from another folder. how can I do this? (for example, my .py is in a folder and I want to reach the data from the desktop) Asked By: boxertrain || Source …

Total answers: 2

ModuleNotFoundError while importing python files as modules in Azure App Services

ModuleNotFoundError while importing python files as modules in Azure App Services Question: I am getting started with Azure App Services. I followed this tutorial and was able to get the example main.py app running. The modules (fastapi, uvicorn, etc…) specified in the requirements.txt are all installed and imported correctly. However, when trying to import Python …

Total answers: 2

Colorama, Fore is applying red to the whole code

Colorama, Fore is applying red to the whole code Question: So I have imported the module Colorama and used print(Fore.RED + "JasoPC copyright 2022") and it applies this to every print and text displayed under it, how do I fix this? import colorama from colorama import Fore user = input("Please enter your name_>>> ") print(Fore.RED …

Total answers: 1

import module in Django

import module in Django Question: I have a project with structure like on this picture. Folders structure Where ‘backend’ folder is Django project folder. I need to import module from another folder ‘main’ inside Django app file, i.e. import main.Text_Generator in backend.app.views file. I tried: from …main.Text_Generator import *. This raise an error while running …

Total answers: 2