python Name 'package' is not defined error - python

After installing the pyautogui package with pip, I tried using it in the IDLE shell by typing pyautogui.
However I get the following error:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
pyautogui
NameError: name 'pyautogui' is not defined
I have scoured the web but have not been able to identify why IDLE will not recognise that pyautogui is installed.
Please let me know if you need more information to answer.

Have you tried importing the package first?
Try:
import pyautogui

Related

(AttributeError) installation problem with keyboard

I am having a issue when I try to use the keyboard module.
My code is:
import keyboard
keyboard.write('Hello.', 0.3)
And the error was:
C:\Users\user\AppData\Local\Programs\Python\Python310\python.exe "C:/Users/user/Desktop/simple brain/keyboard.py"
Traceback (most recent call last):
File "C:\Users\user\Desktop\simple brain\keyboard.py", line 1, in <module>
import keyboard
File "C:\Users\user\Desktop\simple brain\keyboard.py", line 2, in <module>
keyboard.write('Hello.', 0.3)
AttributeError: partially initialized module 'keyboard' has no attribute 'write' (most likely due to a circular import)
Process finished with exit code 1
I used pip install keyboard in pycharm terminal.
How do I fix the installation of or properly install keyboard?
The name of your file is "keyboard.py". When you do import keyboard, python is trying to import your current file which is causing a circular import. Rename your file to something else.

Pyp3 gives ModuleNotFoundError even if packaged is install

So I'm trying to figure out if I can speed up my code. For that purpose I installed pyp3. But when I try to run the python file using pyp3 I get error in the first line itself ModuleNotFoundError, But when I use simple python my code works smoothly. Is it due to python version difference ? I'm new to pyp3. Any suggestion/help would be appreciated. Thankyou
pypy3 main_feature_extraction.py
Traceback (most recent call last):
File "main_feature_extraction.py", line 1, in <module>
from dotenv import find_dotenv, load_dotenv
ModuleNotFoundError: No module named 'dotenv'

ATD module for Python 3.6

I want to use ATD module in python, I downloaded it throught the command line pip install ATD, and it was Successfully installed. But when I wanna use it in python, it says that the module is not found, does anyone know what's wrong with it, and how can i fix it?
>>> import ATD
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
import ATD
ModuleNotFoundError: No module named 'ATD'

Python Path error - No Module Found error

I'm having issues running ortools on Linux. I downloaded it from google's site (https://developers.google.com/optimization/) and installed it using "make install," but when I go to use it in python I get the following:
Traceback (most recent call last):
File "regular.py", line 42, in <module>
from ortools.constraint_solver import pywrapcp
File "/home/m3/summer/ortools_examples/examples/python/ortools.py", line 2, in <module>
ImportError: No module named linear_solver
It looks like despite installing ortools, its still not in my python path correctly, so when I call it in the file, it doesn't find anything and returns an error, right? Any advice on how to solve this?

Selenium - no module named http.client

I just installed Selenium (from source) for Python 2.7.
When I try to import selenium, I get the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\selenium-2.25.0-py2.7.egg\selenium\__init__.py", line 16, in <module>
from .selenium import selenium
File "C:\Python27\lib\site-packages\selenium-2.25.0-py2.7.egg\selenium\selenium.py", line 19, in <module>
import http.client
ImportError: No module named http.client
What could be causing this? If I remember correctly, http.client is a python 3 module. Why is selenium trying to import it?
Thanks to the help of DSM, I figured it out. Because I had previously ran setup.py with a python3 executable by accident, the selenium build folder was populated with 2to3 converted code. When I later ran python27 setup.py install it ended up using the same build folder for the installation without overwriting its content. I ended up deleting the build folder and trying again, and it works.

Categories

Resources