开发者

Getting NppExec to understand path of the current file in Notepad++ (for Python scripts)

开发者 https://www.devze.com 2023-01-23 20:11 出处:网络
Using windows for the first time in quite awhile and have picked up note开发者_运维百科pad++ and am using the nppexec plugin to run python scripts. However, I noticed that notepad++ doesn\'t pick up t

Using windows for the first time in quite awhile and have picked up note开发者_运维百科pad++ and am using the nppexec plugin to run python scripts. However, I noticed that notepad++ doesn't pick up the directory that my script is saved in. For example, I place "script.py" in 'My Documents' however os.getcwd() prints "Program Files \ Notepad++"

Does anyone know how to change this behavior? Not exactly used to it in Mac.


Notepad++ >nppexec >follow $(current directory)


You could put something like this at the beginning of your script:

import os
os.chdir(os.path.dirname(__file__))
0

精彩评论

暂无评论...
验证码 换一张
取 消