Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/287.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 当收到格式错误的十六进制字符串时,UUID使用str(值)发送到客户端,但ib服务器_Python_Python 2.7_Sqlalchemy_Uuid - Fatal编程技术网

Python 当收到格式错误的十六进制字符串时,UUID使用str(值)发送到客户端,但ib服务器

Python 当收到格式错误的十六进制字符串时,UUID使用str(值)发送到客户端,但ib服务器,python,python-2.7,sqlalchemy,uuid,Python,Python 2.7,Sqlalchemy,Uuid,我在SQLAlchemy uuid4中使用了一个列,得到的值类似于16d11d6abdaf4fe9905a56e0be8d15d1 我需要使用json格式将这个id发送给客户机,将来从客户机id接收并通过数据库进行查询。 我正在发送 result = {'id': str(id)} #this is from Tornado handler self.write(simplejson.dumps(result)) 当我从用户发送json时,在服务器上提取 data = tornado.esca

我在SQLAlchemy uuid4中使用了一个列,得到的值类似于
16d11d6abdaf4fe9905a56e0be8d15d1
我需要使用json格式将这个id发送给客户机,将来从客户机id接收并通过数据库进行查询。 我正在发送

result = {'id': str(id)}
#this is from Tornado handler
self.write(simplejson.dumps(result))
当我从用户发送json时,在服务器上提取

data = tornado.escape.json_decode(self.request.body)
id = data.get('id', None)
#also tornado handler when I receive id from client
#I also have tried like uuid.UUID(bytes=id.bytes) but also get error
我总是遇到错误,比如格式错误的十六进制字符串。如何在json中发送到客户端和从客户端发送到服务器uuid

第一个:

result = {'id': str(id)}
#If the given chunk is a dictionary, we write it as JSON and set
#the Content-Type of the response to be application/json.
self.write(result)
第二条:

#Returns the value of the argument with the given name
id = self.get_argument("id")
对不起,我的英语很差