0

If I use IDLE editor there is no any error occurs. but when I use sublime or VS code and for output I run my file (python test.py) in terminal or CMD it generate this error I try many commands to resolve but nothing changes like

pip install mysql

pip install pymysql

pip install mysql-connector

and watch many error videos but this error is not resolving. If someone know please help regard this.

On IDLE SHELL everything's works fine but in CMD these errors come. I also attached Screenshots for further information.

enter image description here

enter image description here

Error in CMD:

Traceback (most recent call last):
  File "C:\Users\Ubaid\Desktop\Python\test.py", line 1, in <module>
    import pymysql
  File "C:\Users\Ubaid\AppData\Roaming\Python\Python312\site-packages\pymysql\__init__.py", line 59, in <module>
    from . import connections  # noqa: E402
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Ubaid\AppData\Roaming\Python\Python312\site-packages\pymysql\connections.py", line 7, in <module>
    import socket
  File "C:\Program Files\Python312\Lib\socket.py", line 55, in <module>
    import os, sys, io, selectors
  File "C:\Program Files\Python312\Lib\selectors.py", line 12, in <module>
    import select
  File "C:\Users\Ubaid\Desktop\Python\select.py", line 2, in <module>
    mysql=pymysql.connect(
          ^^^^^^^^^^^^^^^
AttributeError: partially initialized module 'pymysql' has no attribute 'connect' (most likely due to a circular import)

Command Prompt Screen shot

IDLE ScreenShot

5
  • Looks like you are running 2 different files? test.py vs select.py Commented Jan 19, 2024 at 8:23
  • Rename select.py, it's clashing with a core python module Commented Jan 19, 2024 at 8:40
  • I have the same code on both files. test.py and select.py and also select.py is not giving me any output. Commented Jan 19, 2024 at 9:26
  • I also attached the s.s, I restart my system close everything and get the same issue. @User404 Commented Jan 19, 2024 at 9:29
  • @snakecharmerb check my another pic Commented Jan 19, 2024 at 9:30

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.