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

StackOverflow https://stackoverflow.com/questions/4103085

  •  29-09-2019
  •  | 
  •  

문제

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.

도움이 되었습니까?

해결책

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__))
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top