I'm new to terminal, and am just following a beginners python course, I've saved an "example.py" file and im trying to open it but get this error?

enter image description here

also where it says "pc-79-59" that used to say the name of my MacBook as found in systems > sharing, but now it doesn't?

1 Answer

mq1998:

example.py is a file. If you want to edit a file you need a text editor like nano, vim, etc.

  1. First, check if you have installed one of these. If you don't have installed a text editor, install with your package manager. For example, in ubuntu/debian you can install:
apt-get update apt-get install packageName 
  1. To open a file, use the name of the text editor and the filename:
nano example.py 

or

vim example.py 

etc.

  1. Finally, to execute your python program:
python example.py 

And if the version you're using is python3, then:

python3 example.py 

Check if you have installed the python interpreter.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy