Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

364
Views
shell_exec () en php no se ejecuta en bucle for en script python

Hola gears, estoy tratando de ejecutar un script de python desde un sitio, siguiendo su recomendación, uso ajax pero me devuelve el código de python y no ejecuta el código.

Aquí está el código en el lado del navegador

 <script> document.getElementById("button").onclick = function () { $.ajax({ type: 'POST', url: "projet.py", data: {param: ""}, //passing some input here success: function(response){ console.log(output); } }) }; </script> <div class="button" id="button"> Start </div>
 #!/usr/bin/python3 import pymysql.cursors import time import serial # Connect to the database connection = pymysql.connect(host='localhost', user='root', password='******', database='iot', charset='utf8mb4', cursorclass=pymysql.cursors.DictCursor) time.sleep(0.5) while 1 : ser = serial.Serial('/dev/ttyACM0', 9600, timeout=1) ser.flush() while True: if ser.in_waiting > 0: line = ser.readline().decode('utf-8').rstrip() print("Valeur recu :{}".format(line)) break time.sleep(0.5) with connection: with connection.cursor() as cursor: # Create a new record sql = "INSERT INTO `tension` (`valeur`) VALUES (%s)" cursor.execute(sql, (line)) # connection is not autocommit by default. So you must commit to save # your changes. connection.commit() time.sleep(0.5)
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!