Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

(Pyscript) website showing No module named 'mysql' #425

Unanswered
jtoncrise00300 asked this question in Q&A
Discussion options

I'm uploading the following .html to WinSCP, but facing ModuleNotFoundError: No module named 'mysql'

  • html script
<html>
 <head>
 <link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
 <script defer src="https://pyscript.net/latest/pyscript.js"></script>
 </head>
 <body>
 <b><p>title <u><label id="AAA"></label></u> </p></b>
 <br>
 
 <py-script>
 import mysql.connector
 mydb = mysql.connector.connect(
 host="196.168.100.141",
 user="root",
 password="password123", 
 database="database_db", 
 auth_plugin='mysql_native_password'
 )
 
 mycursor = mydb.cursor()
 mycursor.execute("SELECT row_01 FROM database") 
 
 myresult = mycursor.fetchall()
 
 list_01 = []
 
 for row in myresult:
 temp_val = row[0]
 list_01.append(temp_val)
 </py-script>
 </body>
</html>
  • error message
Traceback (most recent call last):
 File "/lib/python3.10/site-packages/_pyodide/_base.py", line 435, in eval_code
 .run(globals, locals)
 File "/lib/python3.10/site-packages/_pyodide/_base.py", line 304, in run
 coroutine = eval(self.code, globals, locals)
 File "<exec>", line 1, in <module>
ModuleNotFoundError: No module named 'mysql'

I already do pip install mysql on my pc, but online website still get this error, so where show I pip install or what shall I do

You must be logged in to vote

Replies: 1 comment

Comment options

Wrong pyscript. This is the custom integration for Home Assistant. What you are looking for is this.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /