Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/302.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在python中执行存储过程_Python_Mysql_Python 2.7 - Fatal编程技术网

在python中执行存储过程

在python中执行存储过程,python,mysql,python-2.7,Python,Mysql,Python 2.7,在使用python调用mysql存储过程时,我遇到了一个语法错误 存储过程的代码如下所示 while True: try: date = time.strftime("%d/%m/%Y") temp,humidity,light = main.reading() args= (192.168.1.145, b8:27:eb:06:e4:4b, Temp_PI, temp) cursor.callproc('SPR_IU_Sensor_Dat

在使用python调用mysql存储过程时,我遇到了一个语法错误

存储过程的代码如下所示

while True:
    try:
      date = time.strftime("%d/%m/%Y")
      temp,humidity,light = main.reading()
      args= (192.168.1.145, b8:27:eb:06:e4:4b, Temp_PI, temp)
      cursor.callproc('SPR_IU_Sensor_Data',args)
      conn.commit()
      time.sleep(interval2)
    except:
        MySQLdb.Error, e:
        conn.rollback()
        print "Transaction aborted: %d: %s" % (e.args[0], e.args[1])
误差如下

  File "procedure.py", line 53
    args= (192.168.1.145, b8:27:eb:06:e4:4b, Temp_PI, temp)
                   ^
SyntaxError: invalid syntax
您需要引用ip地址,并将其作为字符串传递:

Python没有IP地址文字符号的概念

args = ('192.168.1.145', 'b8:27:eb:06:e4:4b', Temp_PI, temp)