Showing posts with label Python file read error IOError22 invalid mode or filename. Show all posts
Showing posts with label Python file read error IOError22 invalid mode or filename. Show all posts

Sunday, March 18, 2012

Learning Python - File Reading

I wanted to learn Python and never had the time to invest. I have started learning Python something I should have done years ago. Anyway, as I am new to Python I found few tutorials along with the Python Documentation very useful.

While trying file handling I came across this error
IOError: (22, "invalid mode ('r') or filename", 'd:\x07.txt')

It took me bit of time to realize that I have given the path name with a wrong slash '\' instead of '/' !
Just thought to document this because when I Googled for the error it was not so easy to find what was wrong.