2

I'm trying to run a python file using Notepad++'s NppExec plugin. My file attempts to import Tkinter using the line "from Tkinter import * ". With NppExec, I run the following script:

python "$(FULL_CURRENT_PATH)"

or sometimes

python -i "$(FULL_CURRENT_PATH)"

In either case, I get the error "ImportError: No module named Tkinter". I find this odd, because if I run my python file using any other method (IDLE, directly from command line, or even with Npp's built in Run function), I get no errors, and Tkinter imports correctly.

I'm running Windows 7, if it makes a difference.

Thanks in advance for your help! -Sam

Abbas
  • 6,720
  • 4
  • 35
  • 49
Sam Westrick
  • 1,248
  • 1
  • 7
  • 9

1 Answers1

8

The problem is simple -- the python command you are running does not have a module named Tkinter. The cause of the problem is more difficult to understand without more information. My first guess would be that NppExec is running a different version of python than you think it is running, and this version of python either doesn't have tkinter installed, or has it installed under a different name (python 2 is Tkinter and python 3 is tkinter).

Try using NppExec to run a script that does the following:

import sys
print sys.executable
print sys.path

The output from those commands should give you enough information to debug the problem.

Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685
  • I also have Lilypond installed on my computer, which in its libraries has an older version of python. NppExec was using this version, so I just switched the command I was sending NppExec: `C:\Python27\python.exe "$(FULL_CURRENT_PATH)"` and now everything works great! thanks! – Sam Westrick Nov 06 '11 at 17:52
  • 1
    python 2 is Tkinter and python 3 is tkinter NAILED it! – alfadog67 Aug 15 '13 at 20:05