Getting NppExec to understand path of the current

2020-07-10 10:56发布

Using windows for the first time in quite awhile and have picked up notepad++ 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.

2条回答
男人必须洒脱
2楼-- · 2020-07-10 11:23

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

查看更多
Emotional °昔
3楼-- · 2020-07-10 11:24

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

import os
os.chdir(os.path.dirname(__file__))
查看更多
登录 后发表回答