Python is not working

so im not into coding and stuff.

i wanted to make a script to make things faster and easier.

whenever i try to open a file using " pyton "
there is an error

python : The term ‘python’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is
correct and try again.
At line:1 char:1

  • python
  •   + CategoryInfo          : ObjectNotFound: (python:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException 

Path is correct
Environment Variables is set
Python is correctly installed

i have no idea

Are you using Windows? Try py instead if python.

If you are on a linux or mac try python3.

If none of this helps then please post the a copy-n-paste of of what you see in the terminal that you are using. Use the </> button to preserve the text as-is.

yes i am on windows.

if i use py instead of python nothing happens, it just writes this PS C:\Users\antho\desktop>

here’s a screenshot Imgur: The magic of the Internet

Does your script print anything? If not, then that’s what I’d expect - it just runs and finishes.

from flask import Flask, request, render_template
from PIL import Image
import folium
import pyautogui
import requests
import base64
from io import BytesIO

app = Flask(__name__)

def get_coordinates(city_name):
    # Costruisci l'URL dell'API Nominatim
    url = ''

    # Definisci i parametri della richiesta
    params = {
        'q': city_name,
        'format': 'json',
        'limit': 1,
        'addressdetails': 1

    # Invia la richiesta all'API e ottieni la risposta
    response = requests.get(url, params=params)
    data = response.json()

    # Estrai le coordinate dalla risposta
    if len(data) > 0:
        latitude = data[0]['lat']
        longitude = data[0]['lon']
        return (latitude, longitude)
        return None

@app.route('/', methods=['GET', 'POST'])
def index():
    if request.method == 'POST':
        # Ottieni il nome della città dal modulo
        city_name = request.form['city_name']

        # Ottieni le coordinate della città
        coordinates = get_coordinates(city_name)

        # Crea una mappa della città al centro della città
        mappa = folium.Map(location=coordinates, zoom_start=12)

        # Aggiungi un marker sulla mappa per indicare la posizione della città

        # Salva la mappa come file HTML'mappa.html')

        # Aspetta che il file HTML della mappa sia aperto nel browser
        pyautogui.PAUSE = 2

i am pretty sure the code is right.

the thing is my pc doensn’t recognize python

Go back to the tutorial and copy-paste an exact example that someone else has given. That way, you KNOW that the code is right (for the record, your above code isn’t, but that’s not really the point here), and you can spend your time figuring out how to make it run. Once you have the example running, THEN start editing it and/or working on your own code, because you can be sure that changes to your code are actually making a difference.

The py command looks like it worked correctly on your system.

i didn’t touch the code, it wasnt a tutorial i used CHATGPT

i am pretty sure the code is right.

What makes you sure?

the thing is my pc doensn’t recognize python

If your pc didn’t recognise python you’d get an error message as you did
using the command python. With the command py you said you just got
your prompt back with no error messages.

Looking at your code, it does not run any kind of “main programme”. All
it does is import various modules (to support the code), defines app
as a Flask instance, defines 2 functions, and then it’s done.

In order to perform further work you need to run the Flask
application, which usually means calling:

which you’re not doing. Try adding that as the last line of the

Note that Flask is a web service, so you’re running a service daemon. It
won’t “do” anything in your terminal window other than sit there waiting
for connections.

To use it you need to connect to it with a web browser on whatever port
it is listening on. It recites the URL on your terminal, so that you
know what that is.

The default URL is

Cameron Simpson

it doesnt work still

You did? Then why didn’t you ask CHATGPT for help instead of us? Clearly it knows more than we do about whether your code is correct.

1 Like

Hahahaha. (Apologies, I’m not laughing at you, I’m laughing at the

I’m curious: what was your prompt for ChatGPT to produce this code?

ChatGPT is known to be confidently wrong about things.

I imagine, given that it can apparently “write” code, that any Python
you get from it will be syntacticly correct. But not necessarily
semanticly correct, in that it won’t necessarily achieve what you asked

Cameron Simpson

No, the code is not right. And yes, your PC is recognising the command “py” and running Python.

You can’t expect to just grab code from ChatGPT and have it work. Don’t believe all the hype. The day will come that 90% of programmers are made redundant by AI code generators, but that day is not this day.

Try putting print("Hello") at the start of the file and print("Goodbye"); input("Press enter to exit") at the very end, and report back what happens.

Broadly true, but I’m not convinced of that last part; I think more that computer complexity has been increasing, and programming languages made more abstract. The natural progression is that we’ll give directives to AI code generators, and those directives will be a new form of programming language - which is basically the same as we do now, but with greater layers of complexity between us and the hardware. Which will give advantages, possibly HUGE advantages, but it won’t put programmers out of a job.

People are pretty terrible at describing their needs to a computer. So the art of programming will continue to be “tell the computer what you want, get a result back, and then refine the instructions until you’re happy with it”.

Thanks to advances in computing technology, programming has changed from “a weird esoteric thing that a small handful of people do” into “something any scientist can learn if s/he wants, and something that can be taught in school”. AI code generation might make it a bit easier for “non-programmers” (and by that I mean “people who think they’re not programmers”) to give instructions to a computer, but no amount of technology will remove the need for skilled people to communicate with computers on their terms.

ok so dont make fun of me for what I asked but ok.

I asked if the ai could do this : Open a browser tab, search a city that the user requested via a box, automatically it searches for the coordinates and look for a map of that city, it makes a screenshot and then makes you save it.

I did, thats why i came here asking for help because I know you guys know more than me and the ai i guess

I’m not making fun of you. I can see it may have seemed that way, and I apologise.

ChatGPT has been all over my news feed recently, with all sorts of weird examples. I’d heard it would produce computer code, but found it hard to credit.

Ah. That’s fairly detailed, and the code does indeed have various pieces which do bits of this in various ways. I’m not sure the entire programme it gave you is sensible, and certainly someone new to Python or coding won’t be able to easily use it.

At the present state of play I wouldn’t recommend trying to obtain working programmes from ChatGPT or similar tools.

At the best of times we programmers spent quite a lot of time finding that what we’re writing for people isn’t quite what they wanted, even when they’ve described it to us. Expecting to give a brief request to an AI and get a working and correct response isn’t feasible. There’s just too much gap between colloquial English (or whatever human language) and a specification precise enough for a programme.


okay, thank you so much