notepad++ 执行python脚本遇到问题
2018-02-10 21:16
387 查看
用notepad++批量转换文本编码格式gb2312->utf-8
结果在x64版本下找不到菜单 Plugins->plugin Manager.
结果在notepad++官网https://notepad-plus-plus.org/download/v7.4.2.html 找到
7.4.2版本,高于此版本的32bit、64bit版本都没有此菜单。只得安装7.4.2 32bit版本
编写python脚本
import os
import sys
from Nppp import notepad # import it first!
filePathSrc="D:\\code\\working\\TDMSServer" # Path to the folder with files to convert
for root, dirs, files in os.walk(filePathSrc):
for fn in files:
if ((fn[-4:] == '.cpp') or (fn[-2:] == '.h')): # Specify type of the files
notepad.open(root + "\\" + fn)
notepad.runMenuCommand("Encoding", "Convert to UTF-8")
notepad.saveAs(root + "\\" + fn) # if you try to save/replace the file, an annoying confirmation window would popup.
notepad.close()
运行,一直提示:“No module named 'Npp'”。
最后反复查找网页,在网页https://sourceforge.net/p/npppythonscript/discussion/1188886/thread/d632d91e/发现了:
于是重新安装,并选择英文版。最终运行成功。
结果在x64版本下找不到菜单 Plugins->plugin Manager.
结果在notepad++官网https://notepad-plus-plus.org/download/v7.4.2.html 找到
7.4.2版本,高于此版本的32bit、64bit版本都没有此菜单。只得安装7.4.2 32bit版本
编写python脚本
import os
import sys
from Nppp import notepad # import it first!
filePathSrc="D:\\code\\working\\TDMSServer" # Path to the folder with files to convert
for root, dirs, files in os.walk(filePathSrc):
for fn in files:
if ((fn[-4:] == '.cpp') or (fn[-2:] == '.h')): # Specify type of the files
notepad.open(root + "\\" + fn)
notepad.runMenuCommand("Encoding", "Convert to UTF-8")
notepad.saveAs(root + "\\" + fn) # if you try to save/replace the file, an annoying confirmation window would popup.
notepad.close()
运行,一直提示:“No module named 'Npp'”。
最后反复查找网页,在网页https://sourceforge.net/p/npppythonscript/discussion/1188886/thread/d632d91e/发现了:
于是重新安装,并选择英文版。最终运行成功。
相关文章推荐
- Python脚本执行Mysql语句遇到死锁问题
- 解决执行python 脚本一闪而过问题
- hive SQL调用python脚本遇到的几个问题
- 解决执行python 脚本一闪而过问题
- 用python编写ASP脚本时遇到的问题,初步的解决方法,目前正在寻找更好的解决办法。
- 在crontab中执行python脚本系统环境变量问题
- 手把手教你:解决pycharm安装后不能执行python脚本的问题
- 运行awk脚本文件遇到不能执行问题
- 今天写python的一个定时关机小脚本遇到的问题
- 【linux】crontab运行python脚本遇到的问题
- 使用python执行复制时遇到的一点问题
- Bat执行Python脚本的问题
- javaweb 使用Process执行python脚本中的一个问题
- 解决执行Oracle控制脚本时遇到的 “cat: /etc/oratab: 没有那个文件或目录”的问题
- python脚本执行出错问题
- 使用Python脚本实现批量网站存活检测遇到问题及解决方法
- java 执行python脚本(出现由于python导入了其他包而无法成功执行的问题)
- python脚本在Windows计划任务执行问题
- python 执行execute遇到的问题
- 解决执行Oracle控制脚本时遇到的 “cat: /etc/oratab: 没有那个文件或目录”的问题