Frictional Games Forum (read-only)
Total n00b programming question - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Frictional Games (https://www.frictionalgames.com/forum/forum-3.html)
+--- Forum: Off-Topic (https://www.frictionalgames.com/forum/forum-16.html)
+--- Thread: Total n00b programming question (/thread-21750.html)



Total n00b programming question - Froge - 06-07-2013

How do you run a Python script you've written in Notepad++?


RE: Total n00b programming question - Your Computer - 06-07-2013

Assuming your environment is set up correctly, doing something as simple as the following in a terminal (or command prompt) would do it:

Code:
python /path/to/file.py

Though, even double clicking the file in a file manager may result in the same thing.


RE: Total n00b programming question - Froge - 06-07-2013

Huh. That works perfectly. Thanks.

However, in my python script there is an instance where I call upon another file to read it:

x = open("test.txt", "r")

And I get the following error from command prompt:

FileNotFoundError: [Errno 2] No such file or directory: "test.txt"


Currently, both the python script I've written as well as text.txt are saved in my python33 folder in C drive, and I've included the location of python33 in "Path" in system variables under advanced systems settings from control panel.

Edit: On another note, if I click on a .py file, the script will execute in command prompt and it does indeed recognize this "text.txt" but closes immediately afterwards for some reason, preventing me from being able to read anything that was printed.