我不能使用awssdk(boto)在python中发送带有重音符号的SQS消息。在
版本
Python:2.7.6 博图:2.20.1
代码
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import boto.sqs
from boto.sqs.message import RawMessage
# print boto.Version
sqs_conn = boto.sqs.connect_to_region(
'my_region',
aws_access_key_id='my_kye',
aws_secret_access_key='my_secret_ky')
queue = sqs_conn.get_queue('my_queue')
queue.set_message_class(RawMessage)
msg = RawMessage()
body = '1 café, 2 cafés, 3 cafés ...'
msg.set_body(body)
queue.write(msg)
一种解决方案:
完整代码:
^{pr2}$来源:https://pythonadventures.wordpress.com/2012/03/29/ascii-codec-cant-encode-character/#comment-4672
相关问题 更多 >
编程相关推荐