7332-Filename-Decoding-Error-in-Graphical-Reports
Don't encode the filename for output. Python does that for you.
This commit is contained in:
parent
85a1c39092
commit
14e1edcd4e
@ -670,13 +670,8 @@ class GVPsDoc(GVDocBase):
|
|||||||
# disappeared. I used 1 inch margins always.
|
# disappeared. I used 1 inch margins always.
|
||||||
# See bug tracker issue 2815
|
# See bug tracker issue 2815
|
||||||
# :cairo does not work with Graphviz 2.26.3 and later See issue 4164
|
# :cairo does not work with Graphviz 2.26.3 and later See issue 4164
|
||||||
# Covert filename to str using file system encoding.
|
|
||||||
if sys.version_info[0] < 3:
|
|
||||||
fname = self._filename.encode(glocale.getfilesystemencoding())
|
|
||||||
else:
|
|
||||||
fname = self._filename
|
|
||||||
|
|
||||||
command = 'dot -Tps:cairo -o"%s" "%s"' % (fname, tmp_dot)
|
command = 'dot -Tps:cairo -o"%s" "%s"' % (self._filename, tmp_dot)
|
||||||
dotversion = str(Popen(['dot', '-V'], stderr=PIPE).communicate(input=None)[1])
|
dotversion = str(Popen(['dot', '-V'], stderr=PIPE).communicate(input=None)[1])
|
||||||
# Problem with dot 2.26.3 and later and multiple pages, which gives "cairo: out of
|
# Problem with dot 2.26.3 and later and multiple pages, which gives "cairo: out of
|
||||||
# memory" If the :cairo is skipped for these cases it gives acceptable
|
# memory" If the :cairo is skipped for these cases it gives acceptable
|
||||||
@ -718,14 +713,8 @@ class GVSvgDoc(GVDocBase):
|
|||||||
dotfile = os.fdopen(handle, "wb")
|
dotfile = os.fdopen(handle, "wb")
|
||||||
dotfile.write(self._dot.getvalue())
|
dotfile.write(self._dot.getvalue())
|
||||||
dotfile.close()
|
dotfile.close()
|
||||||
# Covert filename to str using file system encoding.
|
|
||||||
if sys.version_info[0] < 3:
|
|
||||||
fname = self._filename.encode(glocale.getfilesystemencoding())
|
|
||||||
else:
|
|
||||||
fname = self._filename
|
|
||||||
|
|
||||||
# Generate the SVG file.
|
# Generate the SVG file.
|
||||||
os.system( 'dot -Tsvg:cairo -o"%s" "%s"' % (fname, tmp_dot) )
|
os.system( 'dot -Tsvg:cairo -o"%s" "%s"' % (self._filename, tmp_dot) )
|
||||||
|
|
||||||
# Delete the temporary dot file
|
# Delete the temporary dot file
|
||||||
os.remove(tmp_dot)
|
os.remove(tmp_dot)
|
||||||
@ -761,14 +750,8 @@ class GVSvgzDoc(GVDocBase):
|
|||||||
dotfile = os.fdopen(handle, "wb")
|
dotfile = os.fdopen(handle, "wb")
|
||||||
dotfile.write(self._dot.getvalue())
|
dotfile.write(self._dot.getvalue())
|
||||||
dotfile.close()
|
dotfile.close()
|
||||||
# Covert filename to str using file system encoding.
|
|
||||||
if sys.version_info[0] < 3:
|
|
||||||
fname = self._filename.encode(glocale.getfilesystemencoding())
|
|
||||||
else:
|
|
||||||
fname = self._filename
|
|
||||||
|
|
||||||
# Generate the SVGZ file.
|
# Generate the SVGZ file.
|
||||||
os.system( 'dot -Tsvgz -o"%s" "%s"' % (fname, tmp_dot) )
|
os.system( 'dot -Tsvgz -o"%s" "%s"' % (self._filename, tmp_dot) )
|
||||||
|
|
||||||
# Delete the temporary dot file
|
# Delete the temporary dot file
|
||||||
os.remove(tmp_dot)
|
os.remove(tmp_dot)
|
||||||
@ -804,14 +787,8 @@ class GVPngDoc(GVDocBase):
|
|||||||
dotfile = os.fdopen(handle, "wb")
|
dotfile = os.fdopen(handle, "wb")
|
||||||
dotfile.write(self._dot.getvalue())
|
dotfile.write(self._dot.getvalue())
|
||||||
dotfile.close()
|
dotfile.close()
|
||||||
# Covert filename to str using file system encoding.
|
|
||||||
if sys.version_info[0] < 3:
|
|
||||||
fname = self._filename.encode(glocale.getfilesystemencoding())
|
|
||||||
else:
|
|
||||||
fname = self._filename
|
|
||||||
|
|
||||||
# Generate the PNG file.
|
# Generate the PNG file.
|
||||||
os.system( 'dot -Tpng -o"%s" "%s"' % (fname, tmp_dot) )
|
os.system( 'dot -Tpng -o"%s" "%s"' % (self._filename, tmp_dot) )
|
||||||
|
|
||||||
# Delete the temporary dot file
|
# Delete the temporary dot file
|
||||||
os.remove(tmp_dot)
|
os.remove(tmp_dot)
|
||||||
@ -847,15 +824,9 @@ class GVJpegDoc(GVDocBase):
|
|||||||
dotfile = os.fdopen(handle, "wb")
|
dotfile = os.fdopen(handle, "wb")
|
||||||
dotfile.write(self._dot.getvalue())
|
dotfile.write(self._dot.getvalue())
|
||||||
dotfile.close()
|
dotfile.close()
|
||||||
# Covert filename to str using file system encoding.
|
|
||||||
if sys.version_info[0] < 3:
|
|
||||||
fname = self._filename.encode(glocale.getfilesystemencoding())
|
|
||||||
else:
|
|
||||||
fname = self._filename
|
|
||||||
|
|
||||||
# Generate the JPEG file.
|
# Generate the JPEG file.
|
||||||
os.system( 'dot -Tjpg -o"%s" "%s"' % (fname, tmp_dot) )
|
os.system( 'dot -Tjpg -o"%s" "%s"' % (self._filename, tmp_dot) )
|
||||||
|
|
||||||
# Delete the temporary dot file
|
# Delete the temporary dot file
|
||||||
os.remove(tmp_dot)
|
os.remove(tmp_dot)
|
||||||
|
|
||||||
@ -890,14 +861,8 @@ class GVGifDoc(GVDocBase):
|
|||||||
dotfile = os.fdopen(handle, "wb")
|
dotfile = os.fdopen(handle, "wb")
|
||||||
dotfile.write(self._dot.getvalue())
|
dotfile.write(self._dot.getvalue())
|
||||||
dotfile.close()
|
dotfile.close()
|
||||||
# Covert filename to str using file system encoding.
|
|
||||||
if sys.version_info[0] < 3:
|
|
||||||
fname = self._filename.encode(glocale.getfilesystemencoding())
|
|
||||||
else:
|
|
||||||
fname = self._filename
|
|
||||||
|
|
||||||
# Generate the GIF file.
|
# Generate the GIF file.
|
||||||
os.system( 'dot -Tgif -o"%s" "%s"' % (fname, tmp_dot) )
|
os.system( 'dot -Tgif -o"%s" "%s"' % (self._filename, tmp_dot) )
|
||||||
|
|
||||||
# Delete the temporary dot file
|
# Delete the temporary dot file
|
||||||
os.remove(tmp_dot)
|
os.remove(tmp_dot)
|
||||||
@ -998,13 +963,9 @@ class GVPdfGsDoc(GVDocBase):
|
|||||||
height_pt = int( (paper_size.get_height_inches() * 72) + 0.5 )
|
height_pt = int( (paper_size.get_height_inches() * 72) + 0.5 )
|
||||||
|
|
||||||
# Convert to PDF using ghostscript
|
# Convert to PDF using ghostscript
|
||||||
if sys.version_info[0] < 3:
|
|
||||||
fname = self._filename.encode(glocale.getfilesystemencoding())
|
|
||||||
else:
|
|
||||||
fname = self._filename
|
|
||||||
command = '%s -q -sDEVICE=pdfwrite -dNOPAUSE -dDEVICEWIDTHPOINTS=%d' \
|
command = '%s -q -sDEVICE=pdfwrite -dNOPAUSE -dDEVICEWIDTHPOINTS=%d' \
|
||||||
' -dDEVICEHEIGHTPOINTS=%d -sOutputFile="%s" "%s" -c quit' \
|
' -dDEVICEHEIGHTPOINTS=%d -sOutputFile="%s" "%s" -c quit' \
|
||||||
% ( _GS_CMD, width_pt, height_pt, fname, tmp_ps )
|
% ( _GS_CMD, width_pt, height_pt, self._filename, tmp_ps )
|
||||||
os.system(command)
|
os.system(command)
|
||||||
|
|
||||||
os.remove(tmp_ps)
|
os.remove(tmp_ps)
|
||||||
|
Loading…
Reference in New Issue
Block a user