Python Forum
open python files in other drive
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
open python files in other drive
#1
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
Reply
#2
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 .
akbarza likes this post
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Question Right way to open files with different encodings? Winfried 2 229 Apr-23-2024, 05:50 PM
Last Post: snippsat
  Open files in an existing window instead of new Kostov 2 320 Apr-13-2024, 07:22 AM
Last Post: Kostov
Question How to get a removable disc type in drive Daring_T 12 1,280 Feb-11-2024, 08:55 AM
Last Post: Gribouillis
  Integrating Google Drive in App Lahearle 0 476 Jul-19-2023, 05:51 PM
Last Post: Lahearle
  code to send attachments contained on the drive. stefanoste78 1 868 Oct-12-2022, 02:16 AM
Last Post: Larz60+
  access is denied error 5 for network drive mapping ? ahmedbarbary 2 1,819 Aug-17-2022, 10:09 PM
Last Post: ahmedbarbary
  Cant Access D: Drive kucingkembar 4 1,356 Jul-28-2022, 04:53 PM
Last Post: kucingkembar
  Deploy Python to Cloud and save output to Google Drive chandrabr80 2 1,589 Jan-25-2022, 06:56 AM
Last Post: ndc85430
  Calling exe on network drive GrahamL 4 2,559 Jan-21-2022, 12:01 PM
Last Post: GrahamL
  How to open/load image .tiff files > 2 GB ? hobbyist 1 2,466 Aug-19-2021, 12:50 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020