I get the following error when I try to use the PageOutline Macro on the same page that I have a Graphviz graph:
Error: Macro PageOutline(2-3) failed
'NoneType' object has no attribute 'args'
I used "The Sandbox" wiki page on my trac installation to duplicate this problem, using the following source:
= The Sandbox =
[[PageOutline(2-3)]]
This is just a page to practice and learn WikiFormatting.
Go ahead, edit it freely.
----
== Subheading 1 ==
Test
----
== Subheading 2 ==
Test Again
{{{
#!graphviz
digraph G {Hello->World->Graphviz->Rules}
}}}
Below is the output from my trac.log:
13:40:55 Trac[graphviz] INFO: id: $Id: graphviz.py 254 2006-01-03 05:47:12Z pkropf $
13:40:55 Trac[graphviz] INFO: processors: ['dot', 'neato', 'twopi', 'circo', 'fdp']
13:40:55 Trac[graphviz] INFO: formats: ['png', 'jpg', 'gif', 'svg', 'svgz']
13:40:55 Trac[formatter] DEBUG: Executing Wiki macro PageOutline by provider <trac.wiki.macros.PageOutlineMacro object at 0xb7d791cc>
13:40:55 Trac[api] DEBUG: Updating wiki page index
13:40:55 Trac[formatter] DEBUG: Executing Wiki macro graphviz by provider <graphviz.graphviz.GraphvizMacro object at 0xb7d7918c>
13:40:55 Trac[graphviz] DEBUG: dir(req): ['__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__']
13:40:55 Trac[formatter] ERROR: Macro PageOutline(2-3) failed
Traceback (most recent call last):
File "/usr/lib/python2.3/site-packages/trac/wiki/formatter.py", line 376, in _macro_formatter
return macro.process(self.req, args, 1)
File "/usr/lib/python2.3/site-packages/trac/wiki/formatter.py", line 110, in process
text = self.processor(req, text)
File "/usr/lib/python2.3/site-packages/trac/wiki/formatter.py", line 101, in _macro_processor
return macro_provider.render_macro(req, self.name, text)
File "/usr/lib/python2.3/site-packages/trac/wiki/macros.py", line 188, in render_macro
max_depth=max_depth, min_depth=min_depth))
File "/usr/lib/python2.3/site-packages/trac/wiki/formatter.py", line 763, in wiki_to_outline
min_depth)
File "/usr/lib/python2.3/site-packages/trac/wiki/formatter.py", line 717, in format
Formatter.format(self, text, NullOut())
File "/usr/lib/python2.3/site-packages/trac/wiki/formatter.py", line 584, in format
self.handle_code_block(line)
File "/usr/lib/python2.3/site-packages/trac/wiki/formatter.py", line 554, in handle_code_block
self.out.write(self.code_processor.process(self.req, self.code_text))
File "/usr/lib/python2.3/site-packages/trac/wiki/formatter.py", line 110, in process
text = self.processor(req, text)
File "/usr/lib/python2.3/site-packages/trac/wiki/formatter.py", line 101, in _macro_processor
return macro_provider.render_macro(req, self.name, text)
File "build/bdist.linux-i686/egg/graphviz/graphviz.py", line 91, in render_macro
AttributeError: 'NoneType' object has no attribute 'args'
13:40:55 Trac[formatter] DEBUG: Executing Wiki macro graphviz by provider <graphviz.graphviz.GraphvizMacro object at 0xb7d7918c>
13:40:55 Trac[graphviz] DEBUG: dir(req): ['_CGIRequest__environ', '_CGIRequest__input', '_CGIRequest__output', '__class__', '__delattr__', '__dict__', '__doc__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', '__weakref__', '_getFieldStorage', '_headers', '_send_cookie_headers', 'args', 'authname', 'base_url', 'cgi_location', 'check_modified', 'display', 'end_headers', 'get_header', 'hdf', 'idx_location', 'incookie', 'method', 'outcookie', 'path_info', 'perm', 'read', 'redirect', 'remote_addr', 'remote_user', 'scheme', 'send_file', 'send_header', 'send_response', 'server_name', 'server_port', 'session', 'write']
13:40:55 Trac[graphviz] DEBUG: req.args: FieldStorage(None, None, [MiniFieldStorage('page', 'SandBox')])
13:40:55 Trac[graphviz] DEBUG: req.base_url: https://XXXXXXXXXXXXXXXXXX.com/trac/dev
13:40:55 Trac[graphviz] DEBUG: self.cache_dir: /tmp/trac/graphviz
13:40:55 Trac[graphviz] DEBUG: self.cmd_path: /usr/bin
13:40:55 Trac[graphviz] DEBUG: self.prefix_url: https://XXXXXXXXXXXXXXXX.com/trac/graphviz
13:40:55 Trac[graphviz] DEBUG: self.out_format: png
13:40:55 Trac[graphviz] DEBUG: self.processor: dot
13:40:55 Trac[graphviz] DEBUG: self.png_anti_alias: True
13:40:55 Trac[graphviz] DEBUG: self.rsvg_path: /usr/bin/rsvg
13:40:55 Trac[graphviz] DEBUG: self.cache_max_count: 2000
13:40:55 Trac[graphviz] DEBUG: self.cache_min_count: 1500
13:40:55 Trac[graphviz] DEBUG: self.cache_max_size: 10000000
13:40:55 Trac[graphviz] DEBUG: self.cache_min_size: 5000000
The problem will go away if I either remove the graphviz graph, or remove the PageOutline macro. Although the error reports itself as a PageOutline issue, the trac.log seems to point to GraphvizPlugin as the cause.
We are using a modified version of 0.9 release, however, I don't believe that our modifications are causing this issue. I have not yet been able to try it on the latest 0.9.4 version.
If you have any questions feel free to post them here