bambam2021
Posts: 1
Joined: Thu Dec 03, 2015 3:04 pm

Need help with running python code

Thu Dec 03, 2015 3:12 pm

Hey!

Literally the most unskilled person when it comes to RPi, this is a brand new thing for me. A tutor has loaded python code? onto the board for me to work with and get to know for a certain project.

What I need help with is actually running it, like making it work? I kind of remember is being something like ./run. something? So new to all of this, would ask my tutor but he is on holiday now :(

thanks guys!

User avatar
expandables
Posts: 654
Joined: Fri Jun 27, 2014 7:34 pm
Location: Neverland with Michael Jackson

Re: Absolute Beginner!!

Thu Dec 03, 2015 3:44 pm

Your code is in python so to run it type

Code: Select all

py
Also buy yourself a python book http://shop.oreilly.com/category/browse ... /python.do
Or use youtube https://www.youtube.com/results?search_ ... +beginners
:twisted:
By thinking like an engineer you can create a raspberry pi.
Michael Jackson enthusiast.
I got the PI model B, B+ and PI 2 model B.
When will I get the A? I don't know.

ame
Posts: 3172
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: Need help with running python code

Thu Dec 03, 2015 11:58 pm

To run it type

Code: Select all

./myprogram.py
or

Code: Select all

python myprogram.py

User avatar
quipu
Posts: 4
Joined: Thu Dec 03, 2015 9:04 pm
Location: Haven't decide that yet

Re: Need help with running python code

Fri Dec 04, 2015 12:51 am

Code: Select all

cd /home/pi
#assuming your program is here, so we go to that folder using cd command and correct path
./myprogram.py
# "." doth means current folder and your programs name with phytons extension ".py"
#OR
python myprogram.py
# means run myprogram.py with phyton 

Code: Select all

“What we observe is not nature itself, but nature exposed to our method of questioning.”
Werner H.

Return to “Python”