Opened 3 years ago

Closed 3 years ago

#8855 closed defect (fixed)

TypeError: CreateProcess() argument 2 must be string without null bytes or None, not str

Reported by: anonymous Owned by: kisielk
Priority: normal Component: TracMathPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.12


I encountered the TypeError in the summary when running Trac 0.13dev-r10696 on Win32 with Python 2.6.5.

I was able to resolve the problem by removing the use of shlex.split from latex_proc and dvipng_proc (lines ~152/162 of - e.g. I used

latex_proc = Popen(cmd, stdout=PIPE, stderr=PIPE)
dvipng_proc = Popen(cmd, stdout=PIPE, stderr=PIPE)

...which seemed to work fine.


File "C:/dev/bin/Python26/lib/site-packages/trac/wiki/templates/wiki_view.html", line 60, in <Expression u'wiki_to_html(context, text)'>
  <div id="wikipage" py:content="wiki_to_html(context, text)" />
File "C:/dev/bin/Python26/lib/site-packages/trac/wiki/", line 1515, in format_to_html
  return HtmlFormatter(env, context, wikidom).generate(escape_newlines)
File "C:/dev/bin/Python26/lib/site-packages/trac/wiki/", line 1470, in generate
File "C:/dev/bin/Python26/lib/site-packages/trac/wiki/", line 1218, in format
  self.handle_code_block(line, block_start_match)
File "C:/dev/bin/Python26/lib/site-packages/trac/wiki/", line 1108, in handle_code_block
  processed = self.code_processor.process(code_text)
File "C:/dev/bin/Python26/lib/site-packages/trac/wiki/", line 334, in process
  text = self.processor(text)
File "C:/dev/bin/Python26/lib/site-packages/trac/wiki/", line 321, in _macro_processor
File "c:/www/trac/quantwiki/plugins/", line 89, in expand_macro
  return self._internal_render(formatter.req, name, content)
File "c:/www/trac/quantwiki/plugins/", line 153, in _internal_render
  latex_proc = Popen(shlex.split(cmd), stdout=PIPE, stderr=PIPE)
File "C:/dev/bin/Python26/Lib/", line 633, in __init__
  errread, errwrite)
File "C:/dev/bin/Python26/Lib/", line 842, in _execute_child

File "c:/www/trac/quantwiki/plugins/", line 153, in _internal_render
  latex_proc = Popen(shlex.split(cmd), stdout=PIPE, stderr=PIPE)

PIPE 	-1
Popen 	<class 'subprocess.Popen'>
cmd 	u'C:\\dev\\bin\\MiKTeX2.8\\miktex\\bin\\latex.exe ...
content 	u'$\\mbox{Var}[\\tau(X_p,X_d)] = \\mbox{Var}[E(\\tau(X_p,X_d)|X_p)] ...
f 	<closed file ...
imgname 	'05f2f6cbc23e71791bba932f25e4b61677cdd3ab.png'
imgpath 	u'C:\\www\\trac\\QuantWiki\\htdocs\\math_cache\\05f2f6cbc23e71791bba932f25e ...
key 	'05f2f6cbc23e71791bba932f25e4b61677cdd3ab'
label 	None
line 	u''
m 	None
name 	u'latex'
req 	<Request "GET '/wiki/WikiStart'">
self 	<tracmath.TracMathPlugin object at 0x04354550>
sha1 	<built-in function openssl_sha1>
shlex 	<module 'shlex' from 'C:\dev\bin\Python26\Lib\shlex.pyc'>
texname 	'05f2f6cbc23e71791bba932f25e4b61677cdd3ab.tex'
texpath 	u'C:\\www\\trac\\QuantWiki\\htdocs\\math_cache\\05f2f6cbc23e71791bba932f25e ...

File "C:/dev/bin/Python26/Lib/", line 633, in __init__
  errread, errwrite)
args 	['C\x00:\x00\x00d\x00e\x00v\x00\x00b\x00i\x00n\x00\x00M\x00i\x00K\x00T\x00e ...
bufsize 	0
c2pread 	<_subprocess_handle object at 0x04424E30>
c2pwrite 	<_subprocess_handle object at 0x04424590>
close_fds 	False
creationflags 	0
cwd 	None
env 	None
errread 	<_subprocess_handle object at 0x04424E60>
errwrite 	<_subprocess_handle object at 0x04424C90>
executable 	None
p2cread 	<_subprocess_handle object at 0x04424ED0>
p2cwrite 	None
preexec_fn 	None
self 	<subprocess.Popen object at 0x0463C670>
shell 	False
startupinfo 	None
stderr 	-1
stdin 	None
stdout 	-1
universal_newlines 	False

User Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv: Gecko/20101203 Firefox/3.6.13 GTB7.1
Trac 	0.13dev-r10696
Docutils 	0.7
Genshi 	0.6
mod_wsgi 	3.3 (WSGIProcessGroup WSGIApplicationGroup %{GLOBAL})
Pygments 	1.3.1
pysqlite 	2.6.3
Python 	2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)]
pytz 	2010h
setuptools 	0.6c11
Subversion 	1.6.16 (r1073529)
jQuery	1.5.1

Attachments (0)

Change History (1)

comment:1 Changed 3 years ago by kisielk

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

I believe this is fixed in the 0.4 release of the plugin.

Add Comment

Modify Ticket

as closed .
The resolution will be deleted. Next status will be 'reopened'.

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

Note: See TracTickets for help on using tickets.