I’m having a problem with Python 2.6 on windows.
Whether I try:
fileobj=open("nonexistent.txt","w")
or
fil=os.open("nonexistent.txt", os.O_CREAT)
fileobj=file(fil)
I get an error:
IOError: [Errno 2] No such file or directory: ‘nonexistent.txt’
What may be the problem?
You will not be able to read the file if it does not exist, however, you should be able to write to it. Does the code below return the same error?