#6392 closed defect (fixed)
AttributeError: type object 'lxml.etree.XSLT' has no attribute 'strparam'
Reported by: | Owned by: | Aurélien Bompard | |
---|---|---|---|
Priority: | normal | Component: | OdtExportPlugin |
Severity: | normal | Keywords: | lxml |
Cc: | Trac Release: | 0.11 |
Description
After installing the odtexport plugin I got the following error message:
Trac detected an internal error: AttributeError: type object 'lxml.etree.XSLT' has no attribute 'strparam'
thanks,
Thomas
System Information:
User Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.6) Gecko/20091215 Ubuntu/9.10 (karmic) Firefox/3.5.6
Trac: 0.11.6
Python: 2.5.2 (r252:60911, Jan 4 2009, 18:00:02) [GCC 4.3.2]
setuptools: 0.6c8
SQLite: 3.5.9
pysqlite: 2.4.1
Genshi: 0.5.1
mod_python: 3.3.1
Pygments: 0.10
GIT: 1.5.6.5
jQuery: 1.2.6
Attachments (0)
Change History (17)
comment:1 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:2 Changed 15 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Updated to the new release, restarted server. However, the bug remains. Added the output, perhaps that helps.
br, Thomas
Most recent call last:
* File "/usr/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/web/main.py", line 450, in _dispatch_request Code fragment: 445. try: 446. if not env and env_error: 447. raise HTTPInternalError(env_error) 448. try: 449. dispatcher = RequestDispatcher(env) 450. dispatcher.dispatch(req) 451. except RequestDone: 452. pass 453. resp = req._response or [] 454. 455. except HTTPException, e: Local variables: Name Value after [u' except RequestDone:', u' pass', u' resp = ... before [u' try:', u' if not env and env_error:', u' raise ... dispatcher <trac.web.main.RequestDispatcher object at 0xa2607ac> e AttributeError("type object 'lxml.etree.XSLT' has no attribute ... env <trac.env.Environment object at 0x9ee024c> env_error None exc_info (<type 'exceptions.AttributeError'>, AttributeError("type object ... filename '/usr/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/web/main.py' frames [{'function': '_dispatch_request', 'lines_before': [u' try:', u' ... has_admin True line u' dispatcher.dispatch(req)' lineno 449 message u"AttributeError: type object 'lxml.etree.XSLT' has no attribute ... req <Request "GET u'/wiki/WikiStart'"> resp [] tb <traceback object at 0xa24ac84> tb_hide None traceback u'Traceback (most recent call last):\n File ... * File "/usr/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/web/main.py", line 206, in dispatch Code fragment: 201. req.args.get('__FORM_TOKEN') != req.form_token: 202. raise HTTPBadRequest('Missing or invalid form token. ' 203. 'Do you have cookies enabled?') 204. 205. # Process the request and render the template 206. resp = chosen_handler.process_request(req) 207. if resp: 208. if len(resp) == 2: # Clearsilver 209. chrome.populate_hdf(req) 210. template, content_type = \ 211. self._post_process_request(req, *resp) Local variables: Name Value chosen_handler <trac.wiki.web_ui.WikiModule object at 0xa26034c> chrome <trac.web.chrome.Chrome object at 0xa26074c> err (<type 'exceptions.AttributeError'>, AttributeError("type object ... handler <trac.wiki.web_ui.WikiModule object at 0xa26034c> req <Request "GET u'/wiki/WikiStart'"> self <trac.web.main.RequestDispatcher object at 0xa2607ac> * File "/usr/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/wiki/web_ui.py", line 165, in process_request Code fragment: 160. else: 161. format = req.args.get('format') 162. if format: 163. Mimeview(self.env).send_converted(req, 'text/x-trac-wiki', 164. versioned_page.text, 165. format, versioned_page.name) 166. return self._render_view(req, versioned_page) 167. 168. # ITemplateProvider methods 169. 170. def get_htdocs_dirs(self): Local variables: Name Value action 'view' format u'odt' old_version None page <trac.wiki.model.WikiPage object at 0xa5ee2d0c> pagename u'WikiStart' req <Request "GET u'/wiki/WikiStart'"> self <trac.wiki.web_ui.WikiModule object at 0xa26034c> version None versioned_page <trac.wiki.model.WikiPage object at 0xa604578c> * File "/usr/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/mimeview/api.py", line 961, in send_converted Code fragment: 956. """Helper method for converting `content` and sending it directly. 957. 958. `selector` can be either a key or a MIME Type.""" 959. from trac.web import RequestDone 960. content, output_type, ext = self.convert_content(req, in_type, 961. content, selector) 962. if isinstance(content, unicode): 963. content = content.encode('utf-8') 964. req.send_response(200) 965. req.send_header('Content-Type', output_type) 966. req.send_header('Content-Length', len(content)) Local variables: Name Value RequestDone <class 'trac.web.api.RequestDone'> content u'\r\n= Welcome to the vfree.tv project wikipages =\r\n\r\nThese pages ... filename u'WikiStart' in_type 'text/x-trac-wiki' req <Request "GET u'/wiki/WikiStart'"> selector u'odt' self <trac.mimeview.api.Mimeview object at 0xa04ab6c> * File "/usr/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/mimeview/api.py", line 669, in convert_content Code fragment: 664. 'to %(new)s', old=mimetype, new=key)) 665. 666. # First successful conversion wins 667. for ck, name, ext, input_mimettype, output_mimetype, quality, \ 668. converter in candidates: 669. output = converter.convert_content(req, mimetype, content, ck) 670. if not output: 671. continue 672. return (output[0], output[1], ext) 673. raise TracError(_('No available MIME conversions from %(old)s to ' 674. '%(new)s', old=mimetype, new=key)) Local variables: Name Value c ('odt', 'OpenDocument', 'odt', 'text/x-trac-wiki', ... candidates [('odt', 'OpenDocument', 'odt', 'text/x-trac-wiki', ... ck 'odt' content u'\r\n= Welcome to the vfree.tv project wikipages =\r\n\r\nThese pages ... converter <odtexport.odtexport.ODTExportPlugin object at 0xa17a5cc> ext 'odt' filename None full_mimetype 'text/x-trac-wiki' input_mimettype 'text/x-trac-wiki' key u'odt' mimetype 'text/x-trac-wiki' name 'OpenDocument' output_mimetype 'application/vnd.oasis.opendocument.text' quality 5 req <Request "GET u'/wiki/WikiStart'"> self <trac.mimeview.api.Mimeview object at 0xa04ab6c> url None * File "build/bdist.linux-i686/egg/odtexport/odtexport.py", line 72, in convert_content Local variables: Name Value content u'\r\n= Welcome to the vfree.tv project wikipages =\r\n\r\nThese pages ... html '<?xml version="1.0"?>\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 ... input_type 'text/x-trac-wiki' odtfile <odtexport.odtexport.ODTFile object at 0xa0441cc> output_type 'odt' page_name u'WikiStart' req <Request "GET u'/wiki/WikiStart'"> self <odtexport.odtexport.ODTExportPlugin object at 0xa17a5cc> * File "build/bdist.linux-i686/egg/odtexport/odtexport.py", line 173, in import_xhtml Local variables: Name Value self <odtexport.odtexport.ODTFile object at 0xa0441cc> xhtml '<?xml version="1.0"?>\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 ... * File "build/bdist.linux-i686/egg/odtexport/odtexport.py", line 185, in xhtml_to_odt Local variables: Name Value self <odtexport.odtexport.ODTFile object at 0xa0441cc> transform <lxml.etree.XSLT object at 0xa28826c> xhtml <Element {http://www.w3.org/1999/xhtml}html at a268b94> xsl_dir '/home/projects/v3tv/.egg-cache/OdtExportPlugin-0.1-py2.5.egg-tmp/odtexport ... xslt_doc <lxml.etree._ElementTree object at 0xa2302cc> File "/usr/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/web/main.py", line 450, in _dispatch_request dispatcher.dispatch(req) File "/usr/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/web/main.py", line 206, in dispatch resp = chosen_handler.process_request(req) File "/usr/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/wiki/web_ui.py", line 165, in process_request format, versioned_page.name) File "/usr/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/mimeview/api.py", line 961, in send_converted content, selector) File "/usr/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/mimeview/api.py", line 669, in convert_content output = converter.convert_content(req, mimetype, content, ck) File "build/bdist.linux-i686/egg/odtexport/odtexport.py", line 72, in convert_contentFile "build/bdist.linux-i686/egg/odtexport/odtexport.py", line 173, in import_xhtmlFile "build/bdist.linux-i686/egg/odtexport/odtexport.py", line 185, in xhtml_to_odt
comment:3 Changed 15 years ago by
Hmm, I have a server with lxml 2.1 around, I managed to reproduce your bug, but my commit fixed it here. Are you sure it's not a cache problem ? Try removing the plugin completely, restarting the server, putting it back, and restarting the server again.
I'm not sure how I should debug this... On the error page, you should have a traceback, and a button "switch to plain text view". Please click on the button and post the plain text traceback here please.
Thanks.
comment:4 Changed 15 years ago by
That's exactly what I did. Removed the directory completely, unzipped the download, restarted the server. Same result again. Here are the files in plain text ( abit difficult to read though)
br, Thomas
ile "/usr/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/web/main.py", line 450, in _dispatch_request dispatcher.dispatch(req) File "/usr/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/web/main.py", line 206, in dispatch resp = chosen_handler.process_request(req) File "/usr/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/wiki/web_ui.py", line 165, in process_request format, versioned_page.name) File "/usr/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/mimeview/api.py", line 961, in send_converted content, selector) File "/usr/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/mimeview/api.py", line 669, in convert_content output = converter.convert_content(req, mimetype, content, ck) File "build/bdist.linux-i686/egg/odtexport/odtexport.py", line 72, in convert_contentFile "build/bdist.linux-i686/egg/odtexport/odtexport.py", line 173, in import_xhtmlFile "build/bdist.linux-i686/egg/odtexport/odtexport.py", line 185, in xhtml_to_odt
comment:5 Changed 15 years ago by
OK, I've updated the SVN again, could you update your copy ? Thanks.
And now I know why the cache was playing tricks on me : it's actually my browser's cache which was getting in the way. When you reload your page, can you bypass the cache (in Firefox it's Ctrl+Shift+R) please ? It did bit me for quite some time until I found this trick...
If you still have the bug, I'd be interested in the plain text traceback again please. You can enclose it in 3 curly braces to keep the formatting, like that:
{{{ traceback }}}
comment:6 Changed 15 years ago by
Hi, unfortunately I'm still getting the same error message after updating, restarting and reloading (even with Ctrl+Shift+R). Pleas see the attached traceback files.
Thanks for your support,
br, Thomas
File "/usr/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/web/main.py", line 450, in _dispatch_request dispatcher.dispatch(req) File "/usr/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/web/main.py", line 206, in dispatch resp = chosen_handler.process_request(req) File "/usr/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/wiki/web_ui.py", line 165, in process_request format, versioned_page.name) File "/usr/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/mimeview/api.py", line 961, in send_converted content, selector) File "/usr/lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/mimeview/api.py", line 669, in convert_content output = converter.convert_content(req, mimetype, content, ck) File "build/bdist.linux-i686/egg/odtexport/odtexport.py", line 72, in convert_contentFile "build/bdist.linux-i686/egg/odtexport/odtexport.py", line 173, in import_xhtmlFile "build/bdist.linux-i686/egg/odtexport/odtexport.py", line 185, in xhtml_to_odt
comment:7 Changed 15 years ago by
OK, I'll try other ways to get information.
- I need your lxml version. You should be able get it with this command :
grep ^Version /usr/lib/python2.*/site-packages/lxml*.egg-info/PKG-INFO
- How did you install lxml ? With the distribution's packages or by another mean ?
- Which distribution are you running Trac on ?
- Please give me the output of:
python -c "import lxml.etree as etree; print etree.XSLT.strparam"
Thanks
comment:8 Changed 15 years ago by
Hi, here we go: The PKG-INFO does not exist in the /usr/lib/python2.5/site-packages directory. The lxml-2.1.1.egg-info contains:
Metadata-Version: 1.0 Name: lxml Version: 2.1.1 ...
- python-lxml was installed from the packages via aptitude, I'm running Debian 5.0 Server
- here's the output of the import statement (as expected):
Traceback (most recent call last): File "<string>", line 1, in <module> AttributeError: type object 'lxml.etree.XSLT' has no attribute 'strparam'
Hope that helps you to trace the issue.
best,
Thomas
comment:9 Changed 15 years ago by
OK, that helps, thanks. Could you run one more command for me please ?
python -c "import lxml.etree as etree; print hasattr(etree.XSLT, 'strparam')"
That's the test I use to enter the lxml "old version" compatibility mode which fixed it for me. On my machine it returns false (no strparam attribute), but on yours it seems to return true, can you confirm it ?
Thanks.
comment:10 Changed 15 years ago by
Hi, to make it even a bit more complicated:
# python -c "import lxml.etree as etree; print hasattr(etree.XSLT, > 'strparam')" False
br, Thomas
comment:11 Changed 15 years ago by
OK, I don't understand what's going on. My code checks this very function, and if false, goes to the "compatibility mode".
I'm pretty sure now that it's a cache problem. Maybe apache uses an egg cache or something. Could you post the relevant apache config section please ?
comment:12 Changed 15 years ago by
Hmm, of course there is the standard setting:
SetEnv PYTHON_EGG_CACHE /home/mydir/.python-eggs
in the apache.conf. However, switching it off, restarting the web server, reloading the page leads to exactly the same error, which is no surprise at it only contains the Genshi package and therefore should not impact anything else.
br, Thomas
comment:13 Changed 15 years ago by
Is your trac instance accessible from the internet ? Could you give me a temporary access ? I'm running out of ideas...
comment:14 Changed 15 years ago by
Unfortunately that's not possible. The trac instance is not accessible from the internet. The alternative would be to install lxml 2.2. I'll try to do that and then let's see what happens.
br, Thomas
comment:15 Changed 15 years ago by
That finally did it. It's not resolving the original issue, but at least it works now. Thanks for your support.
Thomas
comment:16 Changed 15 years ago by
To make sure I just installed Debian Lenny in VirtualBox, installed trac, python-lxml, python-imaging, python-utidylib and exported a wiki page : it worked fine. I'm pretty sure that somehow the old code is running.
At some point I change the version from 0.1 to 0.2, maybe it's that. Please check that you don't have both eggs installed in your plugins dir.
comment:17 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Thanks for the report. This happens with versions of lxml < 2.2. I've adapted the code in r7339 to fix it, please update.