OSError [Errno 22] invalid argument when use open() in Python

OSError [Errno 22] invalid argument when use open() in Python

That is not a valid file path. You must either use a full path

open(rC:description_filesprogram_description.txt,r)

Or a relative path

open(program_description.txt,r)

Add r in starting of path:

path = rD:Folderfile.txt

That works for me.

OSError [Errno 22] invalid argument when use open() in Python

I also ran into this fault when I used open(file_path). My reason for this fault was that my file_path had a special character like ? or <.

Leave a Reply

Your email address will not be published. Required fields are marked *