Modify

Opened 6 years ago

Closed 6 years ago

#3912 closed defect (fixed)

TypeError: argument 1 must be string or read-only buffer, not None

Reported by: cboos Owned by: cboos
Priority: high Component: GraphvizPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

How to Reproduce

While doing a POST operation on /wiki/GraphVizExample, Trac issued an internal error.

When click Preview key i'm get this error

Request parameters:

{'__FORM_TOKEN': u'07fdea90a905373de022904f',
 'action': u'edit',
 'comment': u'',
 'editrows': u'20',
 'page': u'GraphVizExample',
 'preview': u'Preview Page',
 'scroll_bar_pos': u'0',
 'text': u'{{{\r\n#!graphviz\r\n  digraph G {\r\n    rankdir = "LR"\r\n    GraphViz [ URL=GraphvizPlugin ]\r\n    Trac [ \r\n      URL="http://trac.edgewall.org/"   \r\n      fontcolor=blue\r\n    ]\r\n    GraphViz -> Trac\r\n    }\r\n}}}',
 'version': u'0'}

User Agent was: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_4_11; en) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.22

System Information

Trac 0.11.1
Python 2.4.4 (#2, Apr 15 2008, 23:43:20)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)]
setuptools 0.6c9
SQLite 3.3.8
pysqlite 2.3.2
Genshi 0.5.1
Pygments 0.11.1
Subversion 1.4.2 (r22196)
jQuery: 1.2.6

Python Traceback

Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/Trac-0.11.1-py2.4.egg/trac/web/main.py", line 423, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.4/site-packages/Trac-0.11.1-py2.4.egg/trac/web/main.py", line 219, in dispatch
    data, content_type)
  File "/usr/lib/python2.4/site-packages/Trac-0.11.1-py2.4.egg/trac/web/chrome.py", line 715, in render_template
    return stream.render(method, doctype=doctype)
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/core.py", line 179, in render
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/output.py", line 60, in encode
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/output.py", line 311, in __call__
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/output.py", line 753, in __call__
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/output.py", line 592, in __call__
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/output.py", line 698, in __call__
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/output.py", line 532, in __call__
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/core.py", line 283, in _ensure
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/core.py", line 283, in _ensure
  File "/usr/lib/python2.4/site-packages/Trac-0.11.1-py2.4.egg/trac/web/chrome.py", line 767, in _strip_accesskeys
    for kind, data, pos in stream:
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/core.py", line 283, in _ensure
  File "/usr/lib/python2.4/site-packages/Trac-0.11.1-py2.4.egg/trac/web/chrome.py", line 756, in _generate
    for kind, data, pos in stream:
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/core.py", line 283, in _ensure
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/core.py", line 283, in _ensure
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/filters/transform.py", line 686, in _unmark
  File "build/bdist.linux-i686/egg/timingandestimationplugin/tande_filters.py", line 60, in __call__
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/filters/transform.py", line 713, in __call__
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/filters/transform.py", line 682, in _mark
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/core.py", line 283, in _ensure
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/filters/transform.py", line 686, in _unmark
  File "build/bdist.linux-i686/egg/timingandestimationplugin/tande_filters.py", line 60, in __call__
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/filters/transform.py", line 713, in __call__
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/filters/transform.py", line 682, in _mark
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/base.py", line 569, in _include
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/markup.py", line 298, in _match
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/markup.py", line 298, in _match
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/markup.py", line 245, in _match
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/base.py", line 543, in _exec
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/base.py", line 533, in _eval
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/base.py", line 496, in _eval
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/base.py", line 551, in _flatten
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/core.py", line 283, in _ensure
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/path.py", line 141, in _generate
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/base.py", line 569, in _include
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/markup.py", line 234, in _strip
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/base.py", line 543, in _exec
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/base.py", line 533, in _eval
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/base.py", line 496, in _eval
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/base.py", line 551, in _flatten
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/core.py", line 283, in _ensure
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/path.py", line 141, in _generate
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/base.py", line 569, in _include
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/markup.py", line 234, in _strip
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/base.py", line 543, in _exec
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/base.py", line 520, in _eval
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/base.py", line 286, in _eval_expr
  File "/usr/lib/python2.4/site-packages/Genshi-0.5.1-py2.4-linux-i686.egg/genshi/template/eval.py", line 180, in evaluate
  File "/usr/lib/python2.4/site-packages/Trac-0.11.1-py2.4.egg/trac/wiki/templates/wiki_edit.html", line 56, in <Expression u'wiki_to_html(context(page.resource), page.text)'>
    ${wiki_to_html(context(page.resource), page.text)}
  File "/usr/lib/python2.4/site-packages/Trac-0.11.1-py2.4.egg/trac/util/compat.py", line 133, in newfunc
    return func_(*(args + fargs), **dict(kwargs, **fkwargs))
  File "/usr/lib/python2.4/site-packages/Trac-0.11.1-py2.4.egg/trac/wiki/formatter.py", line 1096, in format_to_html
    return HtmlFormatter(env, context, wikidom).generate(escape_newlines)
  File "/usr/lib/python2.4/site-packages/Trac-0.11.1-py2.4.egg/trac/wiki/formatter.py", line 1055, in generate
    escape_newlines)
  File "/usr/lib/python2.4/site-packages/Trac-0.11.1-py2.4.egg/trac/wiki/formatter.py", line 833, in format
    self.handle_code_block(line)
  File "/usr/lib/python2.4/site-packages/Trac-0.11.1-py2.4.egg/trac/wiki/formatter.py", line 764, in handle_code_block
    processed = self.code_processor.process(code_text)
  File "/usr/lib/python2.4/site-packages/Trac-0.11.1-py2.4.egg/trac/wiki/formatter.py", line 179, in process
    text = self.processor(text)
  File "/usr/lib/python2.4/site-packages/Trac-0.11.1-py2.4.egg/trac/wiki/formatter.py", line 166, in _macro_processor
    text)
  File "build/bdist.linux-i686/egg/graphviz/graphviz.py", line 348, in expand_macro
  File "build/bdist.linux-i686/egg/graphviz/graphviz.py", line 534, in _launch
TypeError: argument 1 must be string or read-only buffer, not None


Attachments (0)

Change History (2)

comment:1 Changed 6 years ago by cboos

  • Owner changed from pkropf to cboos
  • Priority changed from normal to high
  • Status changed from new to assigned

It's a typo - input should have been encoded_input.
No NameError exception was raised because input is also a builtin...

I should also try to build rsvg in order to test the "antialias using SVG" code path one day ;-)
In the meantime, could you please check the fix?

Index: graphviz/graphviz.py
===================================================================
--- graphviz/graphviz.py        (revision 4495)
+++ graphviz/graphviz.py        (working copy)
@@ -530,7 +530,7 @@
             encoded_cmd.append(arg)
         p = subprocess.Popen(encoded_cmd, stdin=subprocess.PIPE,
                              stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-        if input:
+        if encoded_input:
             p.stdin.write(encoded_input)
         p.stdin.close()
         out = p.stdout.read()

comment:2 Changed 6 years ago by cboos

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [4536]) GraphvizPlugin: fix typo which went unnoticed because the missing variable name is actually a builtin (closes #3912)

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from cboos. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.