G
G
GArryGAN2021-09-25 13:23:11
Python
GArryGAN, 2021-09-25 13:23:11

How to make the pyautogui python library work without errors?

help, I import the pyautogui library and write the moveTo command

import pyautogui
pyautogui.moveTo(1, 50)

Gives an error:
C:\Users\Egor\PycharmProjects\pythonProject\venv\Scripts\python.exe C:/Users/Egor/PycharmProjects/pythonProject/venv/files/code.py
Traceback (most recent call last):
File "C :/Users/Egor/PycharmProjects/pythonProject/venv/files/code.py", line 1, in
import pyautogui
File "C:\Users\Egor\PycharmProjects\pythonProject\venv\lib\site-packages\pyautogui\__init__. py", line 183, in
import pyscreeze
File "C:\Users\Egor\PycharmProjects\pythonProject\venv\lib\site-packages\pyscreeze\__init__.py", line 74, in
import pygetwindow
File "C:\Users\ Egor\PycharmProjects\pythonProject\venv\lib\site-packages\pygetwindow\__init__.py", line 22, in
import sys, collections,pyrect
File "C:\Users\Egor\PycharmProjects\pythonProject\venv\lib\site-packages\pyrect\__init__.py", line 1, in
import doctest
File "C:\Users\Egor\AppData\Local\Programs\Python \Python38\lib\doctest.py", line 100, in
import pdb
File "C:\Users\Egor\AppData\Local\Programs\Python\Python38\lib\pdb.py", line 77, in
import code
File " C:\Users\Egor\PycharmProjects\pythonProject\venv\files\code.py", line 2, in
pyautogui.moveTo(1, 50)
AttributeError: partially initialized module 'pyautogui' has no attribute 'moveTo' (most likely due to a circular import)

Process finished with exit code 1

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2021-09-25
@GArryGAN

Rename C:/Users/Egor/PycharmProjects/pythonProject/venv/files/code.py During the pyautogui import process, an attempt is made to import the pdb.code module, a name conflict results in a circular import and everything breaks.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question