The file is a device under /dev
. I don't want to mess things up so if the file does not exist, I should not create it. How to handle this in Python?
I hope this problem be solved by open
method. That is, it should throw an IOError like mode "r" when the file does not exist. Don't redirect the question to "check if a file exists".