WHY AM I GETTING THIS ERROR? What is the solution? with conn: AttributeError: __name__ Code Below: import serial import time import MySQLdb as mdb arduino = serial.Serial('/dev/ttyACM0') arduino.baudrate=9600 data = arduino.readline() time.sleep(1) data = arduino.readline() pieces = data.decode('utf-8').split("\t") # pieces = data.decode('utf-8').rstrip() temperature = pieces humidity = pieces conn = mdb.connect('localhost','root','raspberry','exampledb'); cursor = conn.cursor() with conn: cursor.execute("""INSERT INTO tempDB (Temperature,humidity) VALUES(1,%s,%s)""",(te

LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.
5th Edition
ISBN:9781337569798
Author:ECKERT
Publisher:ECKERT
Chapter7: Working With The Bash Shell
Section: Chapter Questions
Problem 7DE
icon
Related questions
Question
WHY AM I GETTING THIS ERROR? What is the solution? with conn: AttributeError: __name__ Code Below: import serial import time import MySQLdb as mdb arduino = serial.Serial('/dev/ttyACM0') arduino.baudrate=9600 data = arduino.readline() time.sleep(1) data = arduino.readline() pieces = data.decode('utf-8').split("\t") # pieces = data.decode('utf-8').rstrip() temperature = pieces humidity = pieces conn = mdb.connect('localhost','root','raspberry','exampledb'); cursor = conn.cursor() with conn: cursor.execute("""INSERT INTO tempDB (Temperature,humidity) VALUES(1,%s,%s)""",(temperature,humidity)) conn.commit() cursor.close()      
Expert Solution
steps

Step by step

Solved in 2 steps with 5 images

Blurred answer
Knowledge Booster
Linux
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.
LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.
Computer Science
ISBN:
9781337569798
Author:
ECKERT
Publisher:
CENGAGE L