6

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.

Assad Ebrahim
  • 6,234
  • 8
  • 42
  • 68
jlv
  • 617
  • 8
  • 13

2 Answers2

15

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

dangermouse
  • 166
  • 2
2

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

import os
os.chdir(os.path.dirname(__file__))
snapshoe
  • 13,454
  • 1
  • 24
  • 28
  • Thanks for this, I'll be using it. Unfortunately, it doesn't seem ideal for long-term. – jlv Nov 05 '10 at 02:50