Python Forum

Full Version: open python files in other drive
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hi
I open Python by searching python word in Windows search and then the Python is opened (python 3.11 window with dark blue color ). (Is this window called python shell?)
I save my files in D drive for example in D:\akb_py_projects .

When after >>> I write the name of a python file, for example echo.py, the below error is shown:
Error:
Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'echo' is not defined
how can I open python files in the above address from the above python window?
thanks
You do not want to open Python that way. Open a shell, CMD or Powershell, change directories to where your echo.py file is located, and type "python echo.py".

I do not understand what you mean by this:
Quote:When after >>> I write the name of a python file, for example echo.py, the below error is shown:

Do you mean that at the python prompt you just typed "echo.py"? ">>>" is the prompt from the interactive python interpreter. It is prompting you to enter a python statement. For example:
Output:
>>> sum(range(100)) 4950
Or in your case:
Output:
>>> from echo import echo >>> print(echo("echo")) cho ho o .