mpl 0.99 and py2exe

I have run into a bit of problem using 0.99 and py2exe.

I am getting errors "TypeError: unsupported operand type(s) for +=: 'NoneType' and 'str'" in mlab.pyo after py2exe'd my application.

This is caused by this type of code, as one normally uses the optimize option with py2exe which means that the docs are stripped from the .pyo files.
"psd.__doc__ = psd.__doc__ % kwdocd"

I changed it to:
if psd.__doc__ is not None:
    psd.__doc__ = psd.__doc__ % kwdocd
else:
    psd.__doc__ = ""

Above is a bit of a hack, if someone can suggest how to correct this in a way which would get accepted as a patch I would search all modules correct them.

Werner

Werner F. Bruhin wrote:

I have run into a bit of problem using 0.99 and py2exe.

I am getting errors "TypeError: unsupported operand type(s) for +=: 'NoneType' and 'str'" in mlab.pyo after py2exe'd my application.

This is caused by this type of code, as one normally uses the optimize option with py2exe which means that the docs are stripped from the .pyo files.
"psd.__doc__ = psd.__doc__ % kwdocd"

I changed it to:
if psd.__doc__ is not None:
    psd.__doc__ = psd.__doc__ % kwdocd
else:
    psd.__doc__ = ""

Above is a bit of a hack, if someone can suggest how to correct this in a way which would get accepted as a patch I would search all modules correct them.
  

Maybe a nicer solution would be:
if __debug__:
    psd.__doc__ = psd.__doc__ % kwdocd

Also that would mean that above is not run when running Python as "python -O script.py or python -OO script.py where the first solution means that with -O the it would still be executed.

Werner