You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Python 3.4 causes a byte decoding error on Windows due to agraph.py Warnings being raised from a joined bytes object instead of a normal str object which has unicode encoding.
The versions of software in use are:
Windows 10 Version 1511 64-bit
Python 3.4.4 32-bit
Graphviz 2.38 32-bit
pygraphviz 1.3.1 32-bit build from http://www.lfd.uci.edu/~gohlke/pythonlibs/
django_extensions 1.6.7
When running graph_models command which uses pygraphviz for graph generation with the django_extensions package the error is as following:
$ ./manage.py graph_models -a -g -o my_project_visualized.png
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\me\project\virtualenv32\lib\site-packages\django\core\management\__init__.py", line 354, in execute_from_command_line
utility.execute()
File "C:\Users\me\project\virtualenv32\lib\site-packages\django\core\management\__init__.py", line 346, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\me\project\virtualenv32\lib\site-packages\django\core\management\base.py", line 394, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\me\project\virtualenv32\lib\site-packages\django\core\management\base.py", line 445, in execute
output = self.handle(*args, **options)
File "C:\Users\me\project\virtualenv32\lib\site-packages\django_extensions\management\utils.py", line 58, in inner
ret = func(self, *args, **kwargs)
File "C:\Users\me\project\virtualenv32\lib\site-packages\django_extensions\management\commands\graph_models.py", line 162, in handle
self.render_output_pygraphviz(dotdata, **options)
File "C:\Users\me\project\virtualenv32\lib\site-packages\django_extensions\management\commands\graph_models.py", line 202, in render_output_pygraphviz
graph.layout(prog=kwargs['layout'])
File "C:\Users\me\project\virtualenv32\lib\site-packages\pygraphviz\agraph.py", line 1358, in layout
data = self._run_prog(prog, ' '.join([args, "-T", fmt]))
File "C:\Users\me\project\virtualenv32\lib\site-packages\pygraphviz\agraph.py", line 1338, in _run_prog
warnings.warn(b"".join(errors), RuntimeWarning)
TypeError: can't use a string pattern on a bytes-like object
The excepted output depicting font warnings would be on Windows:
WARNING:py.warnings:C:\Users\me\project\virtualenv32\lib\site-packages\pygraphviz\agraph.py:1338: RuntimeWarning:
(neato.exe:30444): Pango-WARNING **: couldn't load font "Helvetica Bold Not-Rotated 8", falling back to "Sans Bold Not-Rotated 8", expect ugly output.
(neato.exe:30444): Pango-WARNING **: couldn't load font "Helvetica Italic Not-Rotated 8", falling back to "Sans Italic Not-Rotated 8", expect ugly output.
(neato.exe:30444): Pango-WARNING **: couldn't load font "Helvetica Not-Rotated 8", falling back to "Sans Not-Rotated 8", expect ugly output.
(neato.exe:30444): Pango-WARNING **: couldn't load font "Helvetica ItalicBold Not-Rotated 8", falling back to "Sans Not-Rotated 8", expect ugly output.
(neato.exe:30444): Pango-WARNING **: couldn't load font "Helvetica Bold Not-Rotated 12", falling back to "Sans Bold Not-Rotated 12", expect ugly output.
warnings.warn(b"".join(errors).decode(), RuntimeWarning)
Python 3.4 causes a byte decoding error on Windows due to agraph.py Warnings being raised from a joined
bytes
object instead of a normalstr
object which has unicode encoding.The versions of software in use are:
Windows 10 Version 1511 64-bit
Python 3.4.4 32-bit
Graphviz 2.38 32-bit
pygraphviz 1.3.1 32-bit build from http://www.lfd.uci.edu/~gohlke/pythonlibs/
django_extensions 1.6.7
When running
graph_models
command which uses pygraphviz for graph generation with thedjango_extensions
package the error is as following:The excepted output depicting font warnings would be on Windows:
The crashing segment of code from agraph.py line 1339 is:
After making the following fix the program runs normally on my local machine on Python 3 32-bit, 64-bit, and Python 2.7 64-bit:
I am proposing that to support Python 3 graph generation a bytes decoding is added to the error-causing code segment in
The text was updated successfully, but these errors were encountered: