Thursday, May 16, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 2641  / 3 Years ago, thu, september 23, 2021, 3:20:47

Hello guys I'm actually new to Terminal and Python. Just started following a Python tuturial on my Ubuntu and I've reached a part where it asks me to save a .py file and open it in Terminal.



Only when I try to type on Terminal $ python egotrip.py I get $: command not found
Then I try to type it in python and I get

File "", line 1
python egotrip.py
^
SyntaxError: invalid syntax



But I mean all names are correct :(



Then I gave also tried /home/anacah/Desktop/python/egotrip.py
And I get



Traceback (most recent call last):
File "", line 1, in
NameError: name 'home' is not defined


What am I doing wrong? :( can someone please help?


More From » python

 Answers
4

Try using this line in the terminal:

python /home/anacah/Desktop/python/egotrip.py



thereby providing the entire path for the file including the / at the beginning, and see what happens. If it errors out, please edit your initial post with the section 'Additional Information' and paste the error message.


[#40506] Thursday, September 23, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
diket

Total Points: 167
Total Questions: 124
Total Answers: 109

Location: Somalia
Member since Wed, Mar 15, 2023
1 Year ago
diket questions
Fri, Dec 24, 21, 22:31, 2 Years ago
Fri, Mar 31, 23, 02:30, 1 Year ago
Mon, Jan 23, 23, 05:58, 1 Year ago
Tue, Nov 1, 22, 02:02, 2 Years ago
;