Modify

Opened 6 years ago

Closed 6 years ago

Last modified 4 years ago

#4396 closed defect (fixed)

error: Tidy not found (but works at shell)

Reported by: sunyanzicc.net@… Owned by: lei
Priority: normal Component: PageToDocIntegration
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

Trac Error Msg

Trac detected an internal error:
Exception: Error executing command (return code = 127): /bin/sh: tidy: command not found
Python Traceback

Most recent call last:
File "/usr/local/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/web/main.py", line 423, in _dispatch_request
File "/usr/local/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/web/main.py", line 197, in dispatch
File "/usr/local/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/wiki/web_ui.py", line 161, in process_request
File "/usr/local/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/mimeview/api.py", line 834, in send_converted
File "/usr/local/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg/trac/mimeview/api.py", line 560, in convert_content
File "build/bdist.linux-i686/egg/pagetodoc/pagetodoc.py", line 96, in convert_content
File "build/bdist.linux-i686/egg/pagetodoc/pagetodoc.py", line 161, in execute_external_program

I found the source of trace. pagetodoc.py line94

 args = '-m -asxhtml -latin1 --doctype omit'
        cmd = 'tidy %s %s' % (args, htmlfilepath)

and execute cmd

root@platoo-dev /opt/scm# tidy -m -asxhtml -latin1 --doctype omit /opt/scm/html_                                filtered.xslt
line 2 column 1 - Error: <xsl:stylesheet> is not recognized!
line 2 column 1 - Warning: missing <!DOCTYPE> declaration
line 2 column 1 - Warning: discarding unexpected <xsl:stylesheet>
line 3 column 9 - Error: <xsl:output> is not recognized!
line 3 column 9 - Warning: discarding unexpected <xsl:output>
line 6 column 3 - Error: <xsl:variable> is not recognized!
line 6 column 3 - Warning: discarding unexpected <xsl:variable>
line 2 column 1 - Warning: plain text isn't allowed in <head> elements
line 6 column 61 - Warning: discarding unexpected </xsl:variable>
line 7 column 3 - Error: <xsl:variable> is not recognized!
line 7 column 3 - Warning: discarding unexpected <xsl:variable>
line 7 column 63 - Warning: discarding unexpected </xsl:variable>
line 8 column 3 - Error: <xsl:variable> is not recognized!
line 8 column 3 - Warning: discarding unexpected <xsl:variable>
line 8 column 57 - Warning: discarding unexpected </xsl:variable>
line 11 column 9 - Error: <xsl:template> is not recognized!
228 warnings, 86 errors were found! Not all warnings/errors were shown.

This document has errors that must be fixed before
using HTML Tidy to generate a tidied up version.

So, Is this problem caused by xsltproc haven't installed ?
when I want to install xsltproc, I found so many libs required.. seem a little complicated.
Could you help me about the installation.

Thanks,
Tod.

Attachments (0)

Change History (6)

comment:1 Changed 6 years ago by Tod

I have installed tidy.

comment:2 Changed 6 years ago by anonymous

Hi Tod,

the tool works by converting HTML rendered by trac to HTML which Word can read. Because Word has a specific HTML, there has to be a conversion from one HTML to another. The conversion is carried out by using a XSL-transformation for which the use of an XSLT processor as like as xsltproc is essential. I have chosen xsltproc because it is likely to be installed on linux machines. You might change to a different XSLT processor which has fewer dependencies on your system, but this might require adjustments of the parameters.

Tidy is just used for cleaning up the trac HTML, as the XSLT processor (at least xsltproc I am speaking about) needs strict HTML for the conversion. To ensure this, the output is being cleaned by Tidy (trac core produces strict HTML as far as I know, but there might be additional content by plugins, so I decided to use Tidy).


Oh.. now I see you get an error with Tidy. I have overseen that on the first glance. The first error looks like you haven't installed Tidy, but I think you catched it up later (your comment).
The command you executed is definitely incorrect, because you tried to process the XSL stylesheet with tidy. 'htmlfilepath' refers to the HTML file contains the output of trac.

So there are two options. Stick with xsltproc or modify the program so that it uses a different XSLT processor. I am sorry that the installation carries out this complicated, that was exactly the opposite of what I intended choosing xsltproc. If you find a better solution, please feel free to modify and improve this plugin, as this was my first experience with trac plugins and python scripting at all.

Cheers, Lucas

comment:3 Changed 6 years ago by alex_reality

I have encountered the same error on a freebsd system. I installed all necessary packages from ports, and tidy is available in the command line. But I get "127 - tidy not found" error. I can't even imagine what is wrong...

regards,
alex

comment:4 Changed 6 years ago by markm

Could it be a usr directory problem? I know very little about unix - but if the web server runs under a different user than you - it may have a different path?

comment:5 Changed 6 years ago by markm

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

Hopefully the changes checked in with [5406] allow you to get rid of this error. You can now specify the path to tidy - and the plugin checks that it is actually correct.

comment:6 Changed 6 years ago by markm

  • Summary changed from error to error: Tidy not found (but works at shell)

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.