Can't run python script with an txt entry in powershell [Errno 22]

1769 views python
4

I have installed python 3.7, i'm really new to this and read you can run a script with a txt entry in powershell (already did enviroment path configs). I opened powershell and type: - cd [Python script directory] - python main_1.py

It should run but gives error in return, here is a print, explain it like if i were retard. Any help will be appreciated.

answered question

2 Answers

6

You must either use a full path

open(r"C:\description_files\program_description.txt","r")

Or a relative path

open("program_description.txt","r")

posted this
11

Input redirection (the command line operator <) is not implemented in Windows Powershell. You may want to switch to cmd.exe if you need this functionality.

posted this

Have an answer?

JD

Please login first before posting an answer.