1

EDIT: The code I wrote in my Python file was just this:

   print "foo"

I'm using Windows XP Home Premium on this tiny little HP Mini 1000, and I want to run Python files, since we're learning it in school. I am aware of this topic, so I tried to run Python files using a batch file (python.bat), and I'm getting an error that says, "Can't find 'main' module in ''" whenever I run the batch file. I followed the instructions given here. All I did was change "Python26" to "Python33" because of the difference in versions.

Any idea what's wrong here? I really want to run Python files from Notepad++, so I don't want any alternative ways to run them.

enter image description here

Community
  • 1
  • 1
RickyAYoder
  • 963
  • 1
  • 13
  • 29

2 Answers2

0

This sounds like you don't have PYTHONPATH set up correctly. I suggest you review the documentation here:

http://docs.python.org/2/using/windows.html

Instead of calling Python, call cmd.exe and then use the set command to inspect which variables are set and how they are set. Run the exit command to leave the command shell. When you think you have the variables set up correctly, try again to run Python.

Good luck and have fun!

steveha
  • 74,789
  • 21
  • 92
  • 117
0

I use the command line interpreter or IDLE mostly (Win 8.1 now, but I've done so since Win XP SP2), but NPP is my main text editor, so I was curious about this issue.

When I was reproducing this, I was able to generate several errors, but the only one I got that was an exact match was when I failed to configure the Run option correctly.

You need to make sure to follow this step exactly in the instructions you were following. When you navigate to Run -> Run in Notepad++, you have to enter this exactly:

C:\Python33\python.bat "$(FULL_CURRENT_PATH)"

I am pretty sure you left out the "$(FULL_CURRENT_PATH)", or otherwise didn't add it correctly, as failing to do so causes exactly the same error on my end. Failing to include this means that when you run the batch script, you get the wrong input to the Python interpreter, causing the error.

selllikesybok
  • 1,250
  • 11
  • 17
  • Doesn't it not matter where "python.bat" is located? I copied this EXACTLY, and put python.bat, and now I'm getting another error that says, "Cannot open 'C:\Documents'". (The test file is located in My Documents) – RickyAYoder Nov 23 '13 at 05:20
  • It does not matter where the .bat is, so long as the run command refers to it correctly. When you tried this, where was your .bat file located? If not in python33, that would be the issue. – selllikesybok Nov 23 '13 at 14:23
  • It was in My Documents as well, but the batch file specifies to execute the python.exe with an absolute path, as seen in the screenshot. (C:\Python33\python.exe) – RickyAYoder Nov 23 '13 at 22:44