You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
yd "Iran Rejects Trump’s Offer of Talks as ‘Humiliation’" > output.txt
Traceback (most recent call last):
File "/usr/local/bin/yd", line 11, in <module>
sys.exit(main())
File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/youdao/main.py", line 213, in main
query(keyword, use_db, use_api, play_voice, use_dict)
File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/youdao/main.py", line 117, in query
show_result(result)
File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/youdao/main.py", line 45, in show_result
print colored('\t'+'\n\t'.join(result['translation']), 'cyan')
UnicodeEncodeError: 'ascii' codec can't encode characters in position 6-22: ordinal not in range(128)
The text was updated successfully, but these errors were encountered:
说明
根据以下错误,我发现是格式的问题,我这边先通过
print colored('[%s]' % result['query'].encode('utf-8').strip(), 'magenta')
临时进行了处理,另外,能否增加一个 JSON 或友好的输出格式支持(因为需要与外部系统整合方便使用)Error Output
The text was updated successfully, but these errors were encountered: