![](/img/trans.png)
[英]Getting NppExec to understand path of the current file in Notepad++ (for Python scripts)
[英]Set up Notepad++ and NppExec to print unicode characters from python
我有一个utf-8编码的文件cjk.py
:
print("打印")
不出所料,运行python cjk.py
产生
Traceback (most recent call last):
File "cjk.py", line 1, in <module>
print('\u6253\u5370')
File "C:\Python33\lib\encodings\cp850.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_map)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-1: character maps to <undefined>
然而运行idle -r cjk.py
完美运行:
打印
我可以配置notepad ++的NppExec插件,使其表现得像空闲吗? 我正在尝试将输入和输出编码设置为UTF-8,但无效(与从控制台运行python cjk.py
时相同的异常)
我有同样的问题并修复它。
按F6时,在对话框中的C:\\Python27\\python.exe "$(FULL_CURRENT_PATH)"
下面添加env_set PYTHONIOENCODING=utf-8
。
对我来说就像一个魅力,希望它有所帮助。
资料来源: http : //sourceforge.net/p/npp-plugins/discussion/672146/thread/d94ff609/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.