Edgewall Software
Modify

Opened 14 years ago

Closed 12 years ago

Last modified 7 years ago

#2231 closed defect (wontfix)

Trac do not locate Enscript temp file

Reported by: zwetan@… Owned by: Jonas Borgström
Priority: normal Milestone:
Component: web frontend/mod_python Version: 0.9b2
Severity: major Keywords: enscript needinfo
Cc: Branch:
Release Notes:
API Changes:

Description

I think this is related to Ticket #811.

here the log

3:43:22 AM Trac[svn_fs] DEBUG: Opening subversion file-system at h:\SVN with scope /
3:43:22 AM Trac[cache] DEBUG: Checking whether sync with repository is needed
3:43:22 AM Trac[api] DEBUG: Trying to render HTML preview using EnscriptRenderer
3:43:22 AM Trac[enscript] DEBUG: Enscript command line: C:\buRRRn\shell\enscript\bin\enscript.exe --color -h -q --language=html -p - -Ejavascript
3:43:22 AM Trac[api] WARNING: HTML preview using <trac.mimeview.enscript.EnscriptRenderer object at 0x009F8BB0> failed ([Errno 2] No such file or directory: 'c:\\windows\\temp\\tmpqdmftd')
Traceback (most recent call last):
  File "C:\Python23\lib\site-packages\trac\mimeview\api.py", line 233, in render
    result = renderer.render(req, mimetype, content, filename, rev)
  File "C:\Python23\lib\site-packages\trac\mimeview\enscript.py", line 112, in render
    np = NaivePopen(cmdline, content)
  File "C:\Python23\Lib\site-packages\trac\util.py", line 282, in __init__
    outfd = file(outfile, 'r')
IOError: [Errno 2] No such file or directory: 'c:\\windows\\temp\\tmpqdmftd'
3:43:22 AM Trac[api] DEBUG: Trying to render HTML preview using PlainTextRenderer
3:43:22 AM Trac[api] DEBUG: Using default plain text mimeviewer
3:43:22 AM Trac[svn_fs] DEBUG: Closing subversion file-system at h:\SVN

From my observation of the "c:
windows
temp
" directory a temp file is created but not the one that Trac is looking for

I don't know enought Python but it must be related to a "makeTempFile" command not returning the correct temporary file name.

Attachments (0)

Change History (11)

comment:1 by Matthew Good, 14 years ago

Resolution: duplicate
Status: newclosed

Yes, this seems to be a duplicate of #811.

comment:2 by zwetan@…, 14 years ago

Resolution: duplicate
Status: closedreopened

see my comment on ticket #2233

after resolving the DLL conflict

using tracd Enscript perfectly render the syntax highlighting

using Apache v2.0.55 under Windows 2003 now the error log is not quite the same

6:52:03 AM Trac[svn_fs] DEBUG: Opening subversion file-system at h:\SVN with scope /
6:52:03 AM Trac[cache] DEBUG: Checking whether sync with repository is needed
6:52:03 AM Trac[api] DEBUG: Trying to render HTML preview using EnscriptRenderer
6:52:03 AM Trac[enscript] DEBUG: Enscript command line: C:\buRRRn\shell\enscript\bin\enscript.exe --color -h -q --language=html -p - -Ejavascript
6:52:03 AM Trac[api] WARNING: HTML preview using <trac.mimeview.enscript.EnscriptRenderer object at 0x009F2A90> failed (Running (C:\buRRRn\shell\enscript\bin\enscript.exe --color -h -q --language=html -p - -Ejavascript) failed: 0, 'states' is not recognized as an internal or external command,
operable program or batch file.
.)
Traceback (most recent call last):
  File "C:\Python23\lib\site-packages\trac\mimeview\api.py", line 233, in render
    result = renderer.render(req, mimetype, content, filename, rev)
  File "C:\Python23\lib\site-packages\trac\mimeview\enscript.py", line 115, in render
    raise Exception, err
Exception: Running (C:\buRRRn\shell\enscript\bin\enscript.exe --color -h -q --language=html -p - -Ejavascript) failed: 0, 'states' is not recognized as an internal or external command,
operable program or batch file.
.
6:52:03 AM Trac[api] DEBUG: Trying to render HTML preview using PlainTextRenderer
6:52:03 AM Trac[api] DEBUG: Using default plain text mimeviewer
6:52:03 AM Trac[svn_fs] DEBUG: Closing subversion file-system at h:\SVN
  • it's not the permissions in the enscript bin directory causing problems
  • it's not the path to the enscript executable causing problems

I tried all these combinaison:

C:\buRRRn\shell\enscript\bin\enscript.exe
C:/buRRRn/shell/enscript/bin/enscript.exe
C:\\buRRRn\\shell\\enscript\\bin\\enscript.exe
enscript.exe
enscript
  • I ran the enscript command line
enscript --color -h -q --language=html -p - -Ejavascript H:\tmpProject\blah\HelloWorld.js

and it generate

<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML>
<HEAD>
<TITLE>Enscript Output</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#1F00FF" ALINK="#FF0000" VLINK="#9900DD">
<A NAME="top">
<A NAME="file1">
<H1>H:\tmpProject\blah\HelloWorld.js</H1>

<PRE>

<B><FONT COLOR="#A020F0">function</FONT></B> <B><FONT COLOR="#0000FF">HelloWorld</FONT></B>()
    {
    <B><FONT COLOR="#A020F0">return</FONT></B> <B><FONT COLOR="#BC8F8F">&quot;Hello world&quot;</FON
T></B>;
    }
</PRE>
<HR>
<ADDRESS>Generated by <A HREF="http://www.iki.fi/~mtr/genscript/">GNU enscript 1.6.3</A>.</ADDRESS>
</BODY>
</HTML>
  • in trac.ini

I set

enscript_path =

to nothing

and also tested by completely removing the line

and Trac still log that error:

7:16:24 AM Trac[svn_fs] DEBUG: Opening subversion file-system at h:\SVN with scope /
7:16:24 AM Trac[cache] DEBUG: Checking whether sync with repository is needed
7:16:24 AM Trac[api] DEBUG: Trying to render HTML preview using EnscriptRenderer
7:16:24 AM Trac[enscript] DEBUG: Enscript command line: enscript --color -h -q --language=html -p - -Ejavascript
7:16:24 AM Trac[api] WARNING: HTML preview using <trac.mimeview.enscript.EnscriptRenderer object at 0x009F2A90> failed (Running (enscript --color -h -q --language=html -p - -Ejavascript) failed: 0, 'enscript' is not recognized as an internal or external command,
operable program or batch file.
.)
Traceback (most recent call last):
  File "C:\Python23\lib\site-packages\trac\mimeview\api.py", line 233, in render
    result = renderer.render(req, mimetype, content, filename, rev)
  File "C:\Python23\lib\site-packages\trac\mimeview\enscript.py", line 115, in render
    raise Exception, err
Exception: Running (enscript --color -h -q --language=html -p - -Ejavascript) failed: 0, 'enscript' is not recognized as an internal or external command,
operable program or batch file.
.
7:16:24 AM Trac[api] DEBUG: Trying to render HTML preview using PlainTextRenderer
7:16:24 AM Trac[api] DEBUG: Using default plain text mimeviewer
7:16:24 AM Trac[svn_fs] DEBUG: Closing subversion file-system at h:\SVN

I asked on the mailing list to be sure, someone told me "Trac is always set to prefer SilverCity over Enscript."

I do have installed SilverCity v0.9.5 (for Python v2.3)

so I think there is 2 problems now:

  • why Enscript working with tracd but not with Trac cgi under Apache ?

comment:3 by sid, 13 years ago

Did you ever resolve this? If so, what was the solution?

comment:4 by sid, 13 years ago

Keywords: needinfo added

comment:5 by eric, 13 years ago

Also getting this on a centos 4.2 box

2006-12-08 00:29:02,330 Trac[browser] DEBUG: Rendering preview of node api.php@None with mime-type text/x-php; charset=iso-8859-15
2006-12-08 00:29:02,337 Trac[api] DEBUG: Trying to render HTML preview using PHPRenderer
2006-12-08 00:29:02,346 Trac[php] DEBUG: PHP command line: /usr/bin/php -sn
2006-12-08 00:29:02,376 Trac[api] WARNING: HTML preview using <trac.mimeview.php.PHPRenderer object at 0xb7ba9a8c> failed ([Errno 2] No such file or directory: '/tmp/tmpRiIHb2')
Traceback (most recent call last):
  File "/usr/lib/python2.3/site-packages/trac/mimeview/api.py", line 456, in render
    return Markup(self._annotate(result, annotations))
  File "/usr/lib/python2.3/site-packages/trac/mimeview/api.py", line 490, in _annotate
    for num, line in enumerate(_html_splitlines(lines)):
  File "/usr/lib/python2.3/site-packages/trac/mimeview/api.py", line 620, in _html_splitlines
    for line in lines:
  File "/usr/lib/python2.3/site-packages/trac/mimeview/php.py", line 84, in render
    np = NaivePopen(cmdline, content, capturestderr=1)
  File "/usr/lib/python2.3/site-packages/trac/util/__init__.py", line 146, in __init__
    errfd = file(errfile,'r')
IOError: [Errno 2] No such file or directory: '/tmp/tmpRiIHb2'
2006-12-08 00:29:02,381 Trac[api] DEBUG: Trying to render HTML preview using SilverCityRenderer
2006-12-08 00:29:02,460 Trac[api] DEBUG: Trying to render HTML preview using PlainTextRenderer
2006-12-08 00:29:02,461 Trac[api] DEBUG: Using default plain text mimeviewer

in reply to:  5 comment:6 by Noah Kantrowitz <coderanger@…>, 13 years ago

Replying to eric:

Also getting this on a centos 4.2 box

Check if SELinux is active, and if so look for AVC denial messages.

comment:7 by jc@…, 13 years ago

(was Dup: #4424) I have a very similar issiue, enscript cannot be started when I use mod_python, also other external pograms cannot be launched e.g. htmldoc for PageToPdf.

NO I don't habe SELinux installed!

Trac 0.10, with Apache 2.2 (problems only with mod_python!, running that thing in fcgi is perfect.)

comment:8 by Christian Boos, 13 years ago

Component: browsermod_python frontend
Milestone: 1.0

Brief summary:

  • this issue was originally reported for Enscript on Windows with Apache cgi, while it was working with tracd
        ...
        np = NaivePopen(cmdline, content)
      File "C:\Python23\Lib\site-packages\trac\util.py", line 282, in __init__
        outfd = file(outfile, 'r')
    IOError: [Errno 2] No such file or directory: 'c:\\windows\\temp\\tmpqdmftd'
    
    that particular error was "fixed" after correcting some dlls (see #2233)
  • then it was reported also on Linux, for PHP:
        ...
        np = NaivePopen(cmdline, content, capturestderr=1)
      File "/usr/lib/python2.3/site-packages/trac/util/__init__.py", line 146, in __init__
        errfd = file(errfile,'r')
    IOError: [Errno 2] No such file or directory: '/tmp/tmpRiIHb2'
    
  • and in #4424 for enscript (when run from mod_python)
        ...
        np = NaivePopen(cmdline, content.encode('utf-8'), capturestderr=1)
      File "/var/lib/python-support/python2.4/trac/util/__init__.py", line 142, in _
    _init__
        outfd = file(outfile, 'r')
    IOError: [Errno 2] No such file or directory: '/tmp/tmpuzLyax'
    

… so I wonder if the trouble we see here with NaivePopen and mktemp from within Apache couldn't be due to some other implementation of mktemp suddenly becoming active due to a mix of libraries?

In any case, this does seem to be a valid issue, but with no immediate resolution plans, therefore setting it to milestone:1.0.

If those seeing the issue could get the list of libraries for their running apache process (see TracTroubleshooting for details) and look for mktemp / mkstemp symbols there, I'd be interested (nm $lib | grep mktemp).

comment:9 by Christian Boos, 12 years ago

Milestone: 1.0
Resolution: wontfix
Status: reopenedclosed

Not likely to be resolved on our side.

comment:10 by anonymous, 7 years ago

I had exactly the same errors as described here and the solution which fixes the problem is: Copy states.exe, libiconv-2.dll and libintl-2.dll to a directory that is part of the PATH environment variable of Windows. Then it can be found by enscript.exe and everything works well.

It seems to me that, in enscript.py of Trac,

NaivePopen(cmdline, content.encode('utf-8'), capturestderr=1)

which calls

enscript.exe --color -h -q --language=html -p - -E%s

is not able to reuse the environment of enscript.exe, because actually both DLLs and states.exe is located in the same dir as enscript.exe.

CU, F@lk

comment:11 by anonymous, 7 years ago

Well, to speak more clearly, my workaround refers to [commment:2] of zwetan who said

Exception: Running (C:\buRRRn\shell\enscript\bin\enscript.exe --color -h -q --language=html -p - -Ejavascript) failed: 0, 'states' is not recognized as an internal or external command,
operable program or batch file.

CU, F@lk

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jonas Borgström.
The resolution will be deleted. Next status will be 'reopened'.
to as closed The owner will be changed from Jonas Borgström to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.