Modify

Opened 3 years ago

Closed 3 years ago

#9066 closed defect (fixed)

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

Reported by: anonymous Owned by: 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 (0)

Change History (9)

comment:1 Changed 3 years ago by telexiang@…

  • Keywords TypeError: execv() added

comment:2 Changed 3 years ago by anonymous

  • Component changed from SELECT A HACK to TracMathPlugin
  • Owner set to kisielk

comment:3 follow-up: Changed 3 years ago 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

comment:4 in reply to: ↑ 3 ; follow-up: Changed 3 years ago by stefan.brunig@…

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

comment:5 in reply to: ↑ 4 ; follow-up: Changed 3 years ago 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

comment:6 in reply to: ↑ 5 ; follow-up: Changed 3 years ago by stefan.brunig@…

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?

comment:7 in reply to: ↑ 6 Changed 3 years ago by stefan.brunig@…

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)

comment:8 Changed 3 years ago 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.

comment:9 Changed 3 years ago by kisielk

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

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

Add Comment

Modify Ticket

Action
as 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.