Ticket #9066 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

TypeError: execv() argument 1 must be encoded string without NULL bytes, not str

Reported by: anonymous Assigned to: kisielk
Priority: normal Component: TracMathPlugin
Severity: normal Keywords: TypeError: execv()
Cc: Trac Release: 0.12

Description

my Trac version is 0.12b1 and I use the version https://bitbucket.org/kisielk/tracmathplugin/get/3400be420ed8.tar.gz as the solution of the 'show_err' error mentioned in the ticket 8557.

but there comes the error message

Trac detected an internal error: 
TypeError: execv() argument 1 must be (encoded string without NULL bytes), not str

my Python Traceback

File "/usr/lib/python2.4/site-packages/Trac-0.12b1-py2.4.egg/trac/wiki/templates/wiki_view.html", line 58, in <Expression u'wiki_to_html(context, text)'>
  <div id="wikipage" py:content="wiki_to_html(context, text)" />
File "/usr/lib/python2.4/site-packages/Trac-0.12b1-py2.4.egg/trac/util/compat.py", line 83, in newfunc
  return func_(*(args + fargs), **dict(kwargs, **fkwargs))
File "/usr/lib/python2.4/site-packages/Trac-0.12b1-py2.4.egg/trac/wiki/formatter.py", line 1494, in format_to_html
  return HtmlFormatter(env, context, wikidom).generate(escape_newlines)
File "/usr/lib/python2.4/site-packages/Trac-0.12b1-py2.4.egg/trac/wiki/formatter.py", line 1449, in generate
  escape_newlines)
File "/usr/lib/python2.4/site-packages/Trac-0.12b1-py2.4.egg/trac/wiki/formatter.py", line 1191, in format
  self.handle_code_block(line, block_start_match)
File "/usr/lib/python2.4/site-packages/Trac-0.12b1-py2.4.egg/trac/wiki/formatter.py", line 1086, in handle_code_block
  processed = self.code_processor.process(code_text)
File "/usr/lib/python2.4/site-packages/Trac-0.12b1-py2.4.egg/trac/wiki/formatter.py", line 304, in process
  text = self.processor(text)
File "/usr/lib/python2.4/site-packages/Trac-0.12b1-py2.4.egg/trac/wiki/formatter.py", line 291, in _macro_processor
  text)
File "build/bdist.linux-i686/egg/tracmath/tracmath.py", line 89, in expand_macroFile "build/bdist.linux-i686/egg/tracmath/tracmath.py", line 153, in _internal_renderFile "/usr/lib/python2.4/subprocess.py", line 550, in __init__
  errread, errwrite)
File "/usr/lib/python2.4/subprocess.py", line 996, in _execute_child
  raise child_exception

how can I solve the problem?

regards

Attachments

Change History

08/04/11 11:56:49 changed by telexiang@foxmail.com

  • keywords set to TypeError: execv().

08/04/11 12:01:01 changed by anonymous

  • owner set to kisielk.
  • component changed from SELECT A HACK to TracMathPlugin.

(follow-up: ↓ 4 ) 09/02/11 07:34:23 changed by anonymous

I got same here (trac 0.12.2 and TracMath-0.3-py2.5.egg):

File "/root/.python-eggs/Trac-0.12.2-py2.5.egg-tmp/trac/wiki/templates/wiki_edit.html", line 136, in <Expression u'wiki_to_html(context(page.resource), page.text)'>
  ${wiki_to_html(context(page.resource), page.text)}
File "build/bdist.linux-x86_64/egg/trac/wiki/formatter.py", line 1497, in format_to_html
  return HtmlFormatter(env, context, wikidom).generate(escape_newlines)
File "build/bdist.linux-x86_64/egg/trac/wiki/formatter.py", line 1452, in generate
  escape_newlines)
File "build/bdist.linux-x86_64/egg/trac/wiki/formatter.py", line 1201, in format
  self.handle_code_block(line, block_start_match)
File "build/bdist.linux-x86_64/egg/trac/wiki/formatter.py", line 1091, in handle_code_block
  processed = self.code_processor.process(code_text)
File "build/bdist.linux-x86_64/egg/trac/wiki/formatter.py", line 304, in process
  text = self.processor(text)
File "build/bdist.linux-x86_64/egg/trac/wiki/formatter.py", line 291, in _macro_processor
  text)
File "build/bdist.linux-x86_64/egg/tracmath/tracmath.py", line 89, in expand_macro
  return self._internal_render(formatter.req, name, content)
File "build/bdist.linux-x86_64/egg/tracmath/tracmath.py", line 153, in _internal_render
  latex_proc = Popen(shlex.split(cmd), stdout=PIPE, stderr=PIPE)
File "/usr/lib/python2.5/subprocess.py", line 594, in __init__
  errread, errwrite)
File "/usr/lib/python2.5/subprocess.py", line 1149, in _execute_child
  raise child_exception

Is there already some kind of workaround to get it running?

regards

(in reply to: ↑ 3 ; follow-up: ↓ 5 ) 09/02/11 09:04:58 changed by stefan.brunig@gmail.com

just some more information:

the tex file was succesfully created in the cache directory:

/tmp/tracmath/da1c76cfc5919c0aea6d9c58c65037cd94868e1c.tex

when now executing the latex and dvipng commands manually in that cache directory they succeed:

latex da1c76cfc5919c0aea6d9c58c65037cd94868e1c.tex
dvipng -T tight -x 1200 -z 9 -bg Transparent -o da1c76cfc5919c0aea6d9c58c65037cd94868e1c.png da1c76cfc5919c0aea6d9c58c65037cd94868e1c.dvi

the resulting png is now in the cache directory and rendered correct in trac

Replying to anonymous

(in reply to: ↑ 4 ; follow-up: ↓ 6 ) 09/02/11 10:55:13 changed by anonymous

Replying to stefan.brunig@gmail.com:

just some more information: ...

it works! But how can I get it worked automatically by fixing the tracmatch source code?

I find the commands in line 159~161 https://bitbucket.org/kisielk/tracmathplugin/src/3400be420ed8/tracmath/tracmath.py there maybe some mistake in the execution

(in reply to: ↑ 5 ; follow-up: ↓ 7 ) 09/02/11 11:35:57 changed by stefan.brunig@gmail.com

actually I wonder if the error is more or less python related, maybe there are issues by interpreting the given command as line 153 succeeds?

(in reply to: ↑ 6 ) 09/02/11 14:37:01 changed by stefan.brunig@gmail.com

Replying to stefan.brunig@gmail.com:

actually I wonder if the error is more or less python related, maybe there are issues by interpreting the given command as line 153 succeeds?

sorry, I have to correct myself... in fact line 153 causes the error:

latex_proc = Popen(shlex.split(cmd), stdout=PIPE, stderr=PIPE)

09/11/11 00:59:38 changed by kisielk

  • status changed from new to assigned.

I can't seem to reproduce it. It seems like there must be a null bytes somehow sneaking their way in to the command run by subprocess. Does this happen for all formulas or just some of them?

If it's for all of then, can you attach a copy of your trac.ini to this ticket? Make sure you use the original file and not a copy-paste.

09/11/11 01:55:59 changed by kisielk

  • status changed from assigned to closed.
  • resolution set to fixed.

I believe this has been fixed in version 0.4 of the plugin.


Add/Change #9066 (TypeError: execv() argument 1 must be encoded string without NULL bytes, not str)




Change Properties
Action