ImportError: No module named Npp
-
import os;
import sys;
from Npp import notepadfilePathSrc=“M:\server”
for root, dirs, files in os.walk(filePathSrc):
for fn in files:
if fn[-4:] == ‘.yml’:
notepad.open(root + “\” + fn)
notepad.runMenuCommand(“Encoding”, “Convert to ANSI”)
notepad.runMenuCommand(“Encoding”, “Encode in ANSI”)
notepad.save()
notepad.close()Process started (PID=124000) >>>
Traceback (most recent call last):
File “ansi.py”, line 3, in <module>
from Npp import notepad
ImportError: No module named Npp
<<< Process finished (PID=124000). (Exit code 1) -
did you run the script via NppExec plugin?
You need to use PythonScript Plugin to have access to the notepad objectCheers
Claudia -
How do I run the script through NppExec?
Thanks for the response.
-
you can’t - NppExec does not know anything about Npp - you need to use Python Script plugin as this plugin is creating and exporting the Npp namespace.
Cheers
Claudia -
Thank you!
This problem is solved.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login