cwliang
cwliang

Reputation: 145

how to configure the hotkey of notepad++ for python?

hi I am using notepad++ for python.
I want a hotkey that will run my python script at the path of the script instead of the path of notepad++.
Besides, at the end of process, i want it to show "press any key to continue".

I've tried:

  1. cmd /k "$(FULL_CURRENT_PATH)"
  2. python "$(FULL_CURRENT_PATH)"

But none of them meets my expectations.
For example:

f = open('hello.txt', 'w')
f.close()

This will create 'hello.txt' in the directory of notepad++, but I want to create it at the same path of this script.

Upvotes: 0

Views: 1444

Answers (1)

Raceyman
Raceyman

Reputation: 1354

That's a good find - Notepad++ seems to always set the current working directory to it's own executable directory when scripts are run.

One workaround is to use this: Notepad++ Python Plug-in. This is a plug-in for Notepad++ and adds options to run your scripts in Python from the Plugins menu in Notepad++ (instead of using the Run menu). This should fix your current working directory problem.

Upvotes: 1

Related Questions