在为Telegram制作机器人的过程中。在PyCharm没有问题。所有代码都有效,没有错误。但是当我使用CMD时,这个:
2017-08-12 22:40:27.411036
2017-08-12 22:40:27,412 (util.py:64 WorkerThread2) ERROR - TeleBot: "UnicodeEncodeError occurred, args=('charmap', 'SMS from \u304d\u3064\u307f None. (id = 170683344) \r\n Text - s', 9, 12, 'character maps to <undefined>')
Traceback (most recent call last):
File "C:\Python\Python35\lib\site-packages\telebot\util.py", line 58, in run
task(*args, **kwargs)
File "main.py", line 57, in handle_text
log(message, answer)
File "main.py", line 29, in log
message.text))
File "C:\Python\Python35\lib\encodings\cp437.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_map)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 9-11: character maps to <undefined>
"
Traceback (most recent call last):
File "main.py", line 61, in <module>
bot.polling(none_stop=True, interval=0)
File "C:\Python\Python35\lib\site-packages\telebot\__init__.py", line 264, in polling
self.__threaded_polling(none_stop, interval, timeout)
File "C:\Python\Python35\lib\site-packages\telebot\__init__.py", line 288, in __threaded_polling
self.worker_pool.raise_exceptions()
File "C:\Python\Python35\lib\site-packages\telebot\util.py", line 107, in raise_exceptions
six.reraise(self.exc_info[0], self.exc_info[1], self.exc_info[2])
File "C:\Python\Python35\lib\site-packages\six.py", line 686, in reraise
raise value
File "C:\Python\Python35\lib\site-packages\telebot\util.py", line 58, in run
task(*args, **kwargs)
File "main.py", line 57, in handle_text
log(message, answer)
File "main.py", line 29, in log
message.text))
File "C:\Python\Python35\lib\encodings\cp437.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_map)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 9-11: character maps to <undefined>
(2个第一行 - 右算法) 我在正确的位置,并开始正确的文件。没有问题