Output to StringIO object does not work
Status: Beta
Brought to you by:
robm
It would be really nice if pyemf supported output to a StringIO object rather than assuming that its input object is a filename. This would allow copying to the Windows clipboard in any module that uses pyemf as a backend - such as Matplotlib.
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
This can be fixed fairly trivially by changing pyemf.EMF.save() to this:
def save(self,filename=None):
"""
Write the EMF to disk.
@param filename: filename to write
@type filename: string
@returns: True for success, False for failure.
@rtype: Boolean
"""
self._end()
if filename:
self.filename=filename
if self.filename:
try:
if type(self.filename) == str:
fh=open(self.filename,"wb")
else:
fh = self.filename
self._serialize(fh)
fh.close()
return True
except:
raise
return False
return False