Hello,<br><div class="gmail_quote"><br>in Version 213 of pywin32 within <br><br>win32com\client\genpy.py<br><br>on line 814, within def do_gen_file_header(self): there is the assertion:<br><br># You must provide a file correctly configured for writing unicode.<br>

 # We assert this is it may indicate somewhere in pywin32 that needs<br># upgrading.<br>assert self.file.encoding, self.file<br><br>But using makepy.py via <br>makepy.py -v -o OLE_Excel11.py &quot;Microsoft Excel 11.0 Object Library&quot;<br>

<br>this assertion fails ... as self.file.encoding is None<br><br>The culprit is makepy.py itself: <br><br>starting at line 367ff there is:<br><br>    if outputName is not None:<br>        path = os.path.dirname(outputName)<br>

        if path is not &#39;&#39; and not os.path.exists(path):<br>            os.makedirs(path)<br>        f = open(outputName, &quot;w&quot;)<br>    else:<br>        f = None<br><br>and this &quot;f&quot; will have encoding=None<br>

<br>I patched this to:<br><br>if outputName is not None:<br>        path = os.path.dirname(outputName)<br>        if path is not &#39;&#39; and not os.path.exists(path):<br>            os.makedirs(path)<br>        #~ f = open(outputName, &quot;w&quot;)<br>

        import codecs<br>        f= codecs.open(outputName, mode=&quot;w&quot;,encoding=&quot;mbcs&quot;)<br>    else:<br>        f = None<br><br>use codecs to create a file with mbcs encoding. After this, I get a nice create ole_excel11.py file, with the good line <br>

# -*- coding: mbcs -*-<br><br>at the beginning.<br><br>I propose to put this fix into makepy.py for everybody; (any rights you need are hereby granted)<br><br></div><br>best wishes,<br><br>Harald<br><br>-- <br>GHUM Harald Massa<br>
persuadere et programmare<br>Harald Armin Massa<br>Spielberger Straße 49<br>70435 Stuttgart<br>0173/9409607<br>no fx, no carrier pigeon <br>-<br>LASIK good, steroids bad?<br>