Code: Alles auswählen
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, os
class PseudoFileOut(file):
def __new__(cls, path):
return file.__new__(cls, path, 'w')
path = os.path.join(sys.path[0], 'test.txt')
stream = PseudoFileOut(path)
stream.write("test2")
stream.close()
Code: Alles auswählen
IOError: [Errno 0] Error