Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Total n00b programming question
Froge Offline
Posting Freak

Posts: 2,955
Threads: 176
Joined: Jul 2012
Reputation: 125
#1
Total n00b programming question

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

[Image: p229xcq]
06-07-2013, 02:13 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: Total n00b programming question

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

python /path/to/file.py

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

Tutorials: From Noob to Pro
06-07-2013, 12:53 PM
Website Find
Froge Offline
Posting Freak

Posts: 2,955
Threads: 176
Joined: Jul 2012
Reputation: 125
#3
RE: Total n00b programming question

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.

[Image: p229xcq]
(This post was last modified: 06-07-2013, 05:27 PM by Froge.)
06-07-2013, 05:24 PM
Find




Users browsing this thread: 1 Guest(s)