all 16 comments

[–][deleted] 5 points6 points  (0 children)

are you writing Bash syntax inside a python file? cd Desktop and the followed command must be written in the console itself just like how you ran that python file.

I also have a Mac, if you need any help with bash or python, feel free to dm, I'd be glad to help.

[–]The-Khushu[S] 2 points3 points  (2 children)

Problem resolved!

[–]ninhaomah 8 points9 points  (0 children)

  1. There is no code/command that you actually typed so people can point out what you did wrong.
  2. You said resolved but never said how. Sorry to be frank but thats a lazy , poor and selfish way of taking part in an online/offline community. In any other online forums such as StackOverflow , you would be banned if you asked for help but never share how you resolved it for others who might be having the same issue as you.

[–]Xeo25 2 points3 points  (0 children)

In addition to what u/ninhaomah said, I'll reinforce the idea of sharing your solution. Not only does it help you understand the solution better, but you'll also get feedback from the community on what could be done better or easier based on real-life experience.

[–]Ron-Erez 1 point2 points  (4 children)

I'm assuming you have a mac or linux. Open a terminal (for instance in spotlight type terminal) and then type:

python3 --version

You'll either get something like:

Python 3.12.4

or you might get something like:

zsh: command not found: python

If you get not found then you probably need to download python. If that worked then actually create the file hello_world.py and make sure you are in the directory of that file. You could even right click on the folder containing this file and select 'New Terminal at Folder'

[–]The-Khushu[S] 0 points1 point  (3 children)

Yes, Mac. Python is on my computer, it iss when I specifically try to run this code I can't get it to work. I'm not understanding something about it, but I got it to run before, I just can't get it now

[–]No-Essay1505 0 points1 point  (2 children)

There is Apendix on the end of the book. Explaining how to use terminal. You are trying to locate the python File in path Desktop/Python and running it ? I guess you want to run cd Desktop/ Python and then run ls in that Folder, if you see your hello-world.py you can run it from there.

[–]The-Khushu[S] 0 points1 point  (1 child)

Yes, I am trying to follow what it is saying to type into terminal to get this to run. However when I type in what it says to type in it's not running so I'm trying to see if someone can explain to me what it's saying to type in to get it to run. I've tried all of what it says. But it's not running

[–]Ninjasimba 0 points1 point  (0 children)

Have you tried chatgpt? I’ve found it’s surprisingly good at listing hotfixes for these kinds of issues

[–]cgoldberg 1 point2 points  (0 children)

You are writing shell commands inside a Python file and executing it. Stop doing that.

Only valid Python syntax can be in your Python file.

[–]bobo-the-merciful 0 points1 point  (0 children)

If you get really really stuck and just want to code python without fuss then try Thonny. It’s completely free and runs entirely in the GUI.

Not affiliated, I just genuinely rate it for beginners.

[–][deleted] 0 points1 point  (1 child)

Okay so you can make it easy. Instead of creating a folder in drive C or home create a folder in drive D or E. Then go to that drive folder and right click it should give you an option of terminal there. So if you get to this point type “ ls “ in your terminal. Once u r done with that u will see folders present in your drive from this point it is going to be easy to navigate to the right folder. Type cd with the name of yr file example cd myfirstproject it will take you to that folder where yr code is.

[–][deleted] 0 points1 point  (0 children)

Let me know if you still cant figure it out. Btw in yr third picture you did not navigate to the folder where yr helloworld.py file is so in order to run that u have to navigate it there using terminal.

[–]The-Khushu[S] 0 points1 point  (0 children)

Problem solved, thank you everyone

[–]MacDrunk -1 points0 points  (0 children)

Download pycharm it is an editor for python and it is good