简体   繁体   中英

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

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 environment path configs). I opened PowerShell and type: - cd [Python script directory] - python main_1.py

It should run but gives an error in return, here is the error . Any help will be appreciated.

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.

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")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM