Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 13981

Python MySQL (import pymysql)

$
0
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 hereenter 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)

enter image description here

Command Prompt Screen shot

enter image description here

IDLE ScreenShot


Viewing all articles
Browse latest Browse all 13981

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>