GraphvizMacro.render_macro UnicodeDecodeError thrown
|Reported by:||pkropf||Owned by:||pkropf|
Peter Kropf wrote:
The plugin has been tested on Linux x86 system with python 2.3.5 and the 0.9-stable and trunk branches of Trac.
Testing on other platforms would be appreciated.
I had a prolbem with Graphviz Plugin v0.6.7 and trac 0.10, I first wanted to create a ticket at tac-hacks, but the spam-filter didn't let me :-) So I paste the text here, sorry for the formatting:
If run with trac 0.10, and Python 2.4 GraphvizMacro.render_macro() throws exceptions. According to trac 0.10 release notes, "everything is unicode" now, and that seems to be the problem.
- sha_key = sha.new(self.processor + self.processor_options +
content).hexdigest() throws UnicodeDecodeError
- I tried to correct this in the form:
sha_key = sha.new((self.processor + self.processor_options + content).encode('latin1', 'replace')).hexdigest()
- this works, but after that there occurs an error in
GraphvizMacro.launch() at p_in.writelines()
So it seems to be a more thorough problem. I also tried to correct the writelines() problem with input.encode(...), it worked in some way, but after that the temporary .png files had 0 length, so the plugin didn't work either.
So, unicode strings in trac 0.10 seem to mess up everything. Unfortunately, I don't know graphviz and the plugin good enough to correct the problem myself. By the way, if you only use ascii characters in the graphviz macro definition, everything works.