Package: python3-pydot
Version: 1.0.28-1
Severity: important
Dear Maintainer,
when runing the following code a TypeError is raised, this error is
related to Python3-Support. A transscript follows:
>>> import pydot
>>> a=pydot.Dot()
>>> a.create()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/pydot.py", line 2003, in create
stdout_output = ''.join(stdout_output)
TypeError: sequence item 0: expected str instance, bytes found
I have fixed this problem with the the applied patch.
Perhaps this patch find it's way into the upstream project.
Best Regards,
Olaf Ohlenmacher
-- System Information:
Debian Release: 8.0
APT prefers stable
APT policy: (990, 'stable'), (500, 'stable-updates'), (500,
'proposed-updates')
Architecture: amd64 (x86_64)
Kernel: Linux 3.16.0-4-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)
Versions of packages python3-pydot depends on:
ii graphviz 2.38.0-7
ii python3-pkg-resources 5.5.1-1
ii python3-pyparsing 2.0.3+dfsg1-1
pn python3:any <none>
python3-pydot recommends no packages.
python3-pydot suggests no packages.
-- no debconf information
*** /home/olf/Debian/pydot-1.0.28/0001-fix-joining-of-byte-objects.patch
>From 4ce423bec5dc4cd95354c55e2c38382bd915c721 Mon Sep 17 00:00:00 2001
From: Olaf Ohlenmacher <[email protected]>
Date: Fri, 10 Jul 2015 11:05:27 +0200
Subject: [PATCH] fix joining of byte objects
Function create() is working with bytes object from sys.stout.read()
calls. These calls return byte objects which now will be handled
correctly under Python3.
Fix function description.
Add some comments clearify the object types.
---
pydot.py | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/pydot.py b/pydot.py
index 4c79076..30cd4ec 100644
--- a/pydot.py
+++ b/pydot.py
@@ -1920,7 +1920,7 @@ class Dot(Graph):
create will write the graph to a temporary dot file and process
it with the program given by 'prog' (which defaults to 'twopi'),
- reading the Postscript output and returning it as a string is the
+ reading the output and returning it as a byte object if the
operation is successful.
On failure None is returned.
@@ -1994,25 +1994,27 @@ class Dot(Graph):
stdout_output = list()
while True:
- data = stdout.read()
+ data = stdout.read() # read bytes
if not data:
break
stdout_output.append(data)
stdout.close()
- stdout_output = ''.join(stdout_output)
+ # join list of bytes with "empty" byte-string
+ stdout_output = b''.join(stdout_output)
if not stderr.closed:
stderr_output = list()
while True:
- data = stderr.read()
+ data = stderr.read() # read bytes
if not data:
break
stderr_output.append(data)
stderr.close()
if stderr_output:
- stderr_output = ''.join(stderr_output)
+ # join list of bytes with "empty" byte-string
+ stderr_output = b''.join(stderr_output)
#pid, status = os.waitpid(p.pid, 0)
status = p.wait()
--
2.1.4
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]