Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
4623 มุมมอง

I am trying to create a product.template. The product name contains accent marks from the source database I am importing from. These appear to be causing an issue. Has anyone else ran into this and what is the solution? No matter what I do I can't seem to fix this issue.  I even tried encoding it like row['product_nm'].encode('utf8').

Product Name Example:Super Café (Notice the accent e)

Traceback (most recent call last):

File "import_products.py", line 180, in <module>

template_id=sock.execute(dbname, uid,pwd, 'product.template','create',product_template)

File "/usr/lib/python2.7/xmlrpclib.py", line 1224, in __call__

return self.__send(self.__name, args)

File "/usr/lib/python2.7/xmlrpclib.py", line 1578, in __request

verbose=self.__verbose

File "/usr/lib/python2.7/xmlrpclib.py", line 1264, in request

return self.single_request(host, handler, request_body, verbose)

File "/usr/lib/python2.7/xmlrpclib.py", line 1312, in single_request

response.msg,

xmlrpclib.ProtocolError: <ProtocolError for localhost:8069/xmlrpc/object: 500 INTERNAL SERVER ERROR>

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

I believe I figured out my problem. The character was 8859 and needed to be decode and then encoded in utf8

product_name = product_name.decode('8859').encode('utf8'


Once this change was made it worked.

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
3
ก.ค. 25
2920
1
ต.ค. 24
2098
1
เม.ย. 24
2163
0
ก.ย. 23
1665
1
มิ.ย. 23
2168