Python Programming Language

Status
Not open for further replies.
Hmmm well I haven't! I am going to go look at tutorials. If you know of any good ones, link me...

Edit: I don't see any tutorials, but i set the form of Kod to python and copied one of my programs in to it... Now what should I do?
 
Kod is not an IDE, so you're going to have to open up iTerm (or Terminal, or whatever you use) and cd to the directory where your python program is stored. Then execute "python <name.py>"
 
Kod is not an IDE, so you're going to have to open up iTerm (or Terminal, or whatever you use) and cd to the directory where your python program is stored. Then execute "python <name.py>"

Ohhhhh I see now. Alright thanks.

Edit: When I try to execute it says the file is not found.
 
Are you in the directory where the program is stored? If it's on your desktop, the command would be "cd ~/Desktop". If it's in some folder... /a/b/c/d, it would be "cd /a/b/c/d" etc etc

EDIT: You can also execute the file without going to the directory it's in..
python /path/to/python/program.py

Or I think you can just drag the file int he terminal window... type "python" and drag the file and it should copy the directory after "python "
 
Are you in the directory where the program is stored? If it's on your desktop, the command would be "cd ~/Desktop". If it's in some folder... /a/b/c/d, it would be "cd /a/b/c/d" etc etc

EDIT: You can also execute the file without going to the directory it's in..
python /path/to/python/program.py

Or I think you can just drag the file int he terminal window... type "python" and drag the file and it should copy the directory after "python "

Iterm just responded with this:

>>> /Users/Nick/Desktop/Electronics/Programming/Projects/Tron.py
File "<stdin>", line 1
/Users/Nick/Desktop/Electronics/Programming/Projects/Tron.py
^
SyntaxError: invalid syntax
 
I don't understand.. I've never done Python before so I'm going one step at a time :tongue:

paste the entire output of that iTerm session here, or take a screenshot or something. If I had my laptop handy I'd try one out, but it's in my backpack downstairs :tongue:
 
here's now I would do it...

> cd /Users/Nick/Desktop/Electronics/Programming/Projects

> chmod 777 Tron.py

> python Tron.py

cd changes directory, chmod changes permissions (777 means rwx for all groups, Read, Write and eXecute), and python is the command that executes the Tron.py file.
 
here's now I would do it...

> cd /Users/Nick/Desktop/Electronics/Programming/Projects

> chmod 777 Tron.py

> python Tron.py

cd changes directory, chmod changes permissions (777 means rwx for all groups, Read, Write and eXecute), and python is the command that executes the Tron.py file.

Just using Iterm? Sorry I'm really nooby with this stuff
 
Yep, those are all shell commands. Each is a separate command.. Or you could combine them like this

cd /Users/Nick/Desktop/Electronics/Programming/Projects && chmod 777 Tron.py && python Tron.py
 
Status
Not open for further replies.
Back
Top Bottom