I have an interesting problem that I couldn't solve by googling.
I'm trying to process each file inside of the directory. Some of the file names include special shell characters (
No matches found
IOError: [Errno 2] No such file or directory
IOError: [Errno 2] No such file or directory: 'FOO.-6.BAR.\\(nil\\).\\$0BAZ'
You don't need to escape anything when opening the file from Python, because you aren't executing a shell command at all.
f = open("FOO.-6.BAR.(nil).$0BAZ")
The same is true of any file name returned by
for fname in os.listdir('.'): f = open(fname)