Hello, in Version 213 of pywin32 within
win32com\client\genpy.py on line 814, within def do_gen_file_header(self): there is the assertion: # You must provide a file correctly configured for writing unicode. # We assert this is it may indicate somewhere in pywin32 that needs # upgrading. assert self.file.encoding, self.file But using makepy.py via makepy.py -v -o OLE_Excel11.py "Microsoft Excel 11.0 Object Library" this assertion fails ... as self.file.encoding is None The culprit is makepy.py itself: starting at line 367ff there is: if outputName is not None: path = os.path.dirname(outputName) if path is not '' and not os.path.exists(path): os.makedirs(path) f = open(outputName, "w") else: f = None and this "f" will have encoding=None I patched this to: if outputName is not None: path = os.path.dirname(outputName) if path is not '' and not os.path.exists(path): os.makedirs(path) #~ f = open(outputName, "w") import codecs f= codecs.open(outputName, mode="w",encoding="mbcs") else: f = None use codecs to create a file with mbcs encoding. After this, I get a nice create ole_excel11.py file, with the good line # -*- coding: mbcs -*- at the beginning. I propose to put this fix into makepy.py for everybody; (any rights you need are hereby granted) best wishes, Harald -- GHUM Harald Massa persuadere et programmare Harald Armin Massa Spielberger Straße 49 70435 Stuttgart 0173/9409607 no fx, no carrier pigeon - LASIK good, steroids bad?
_______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32