Description

I get a traceback when I try to highlight an attachment (text.py). pygments can be imported from a normal python shell. Also parsing source of python or java runs into this.

 
 
<type 'exceptions.ImportError'>
Python 2.5.2: /usr/bin/python
Fri Nov 21 21:02:32 2008

A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.

 /usr/lib/python2.5/site-packages/MoinMoin/support/flup/server/fcgi_base.py in run(self=<flup.server.fcgi_base.CGIRequest object at 0xd8b150>)
  556         """Runs the handler, flushes the streams, and ends the request."""
  557         try:
  558             protocolStatus, appStatus = self.server.handler(self)
  559         except:
  560             traceback.print_exc(file=self.stderr)
protocolStatus undefined, appStatus undefined, self = <flup.server.fcgi_base.CGIRequest object at 0xd8b150>, self.server = <flup.server.fcgi_single.WSGIServer object at 0xd84e50>, self.server.handler = <bound method WSGIServer.handler of <flup.server.fcgi_single.WSGIServer object at 0xd84e50>>
 /usr/lib/python2.5/site-packages/MoinMoin/support/flup/server/fcgi_base.py in handler(self=<flup.server.fcgi_single.WSGIServer object at 0xd84e50>, req=<flup.server.fcgi_base.CGIRequest object at 0xd8b150>)
 1114         try:
 1115             try:
 1116                 result = self.application(environ, start_response)
 1117                 try:
 1118                     for data in result:
result = None, self = <flup.server.fcgi_single.WSGIServer object at 0xd84e50>, self.application = <function application at 0xdbd488>, environ = {'DOCUMENT_ROOT': '/var/www/', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'HTTP_ACCEPT_ENCODING': 'gzip,deflate', 'HTTP_ACCEPT_LANGUAGE': 'en,de-de;q=0.8,de;q=0.5,en-us;q=0.3', 'HTTP_CONNECTION': 'keep-alive', 'HTTP_COOKIE': 'MOIN_SESSION=c5e9617e2ab26797c45c41da0766a9ac65d63c58', 'HTTP_HOST': 'localhost', 'HTTP_KEEP_ALIVE': '300', ...}, start_response = <function start_response at 0xdbd500>
 /usr/lib/python2.5/site-packages/MoinMoin/wsgiapp.py in application(environ={'DOCUMENT_ROOT': '/var/www/', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'HTTP_ACCEPT_ENCODING': 'gzip,deflate', 'HTTP_ACCEPT_LANGUAGE': 'en,de-de;q=0.8,de;q=0.5,en-us;q=0.3', 'HTTP_CONNECTION': 'keep-alive', 'HTTP_COOKIE': 'MOIN_SESSION=c5e9617e2ab26797c45c41da0766a9ac65d63c58', 'HTTP_HOST': 'localhost', 'HTTP_KEEP_ALIVE': '300', ...}, start_response=<function start_response at 0xdbd500>)
  235         request = Request(environ)
  236         context = init(request)
  237         response = run(context)
  238         context.clock.stop('total')
  239     except HTTPException, e:
response undefined, global run = <function run at 0xd88938>, context = <AllContext ['AllContext']>
 /usr/lib/python2.5/site-packages/MoinMoin/wsgiapp.py in run(context=<AllContext ['AllContext']>)
   70                 response = xmlrpc.xmlrpc2(XMLRPCContext(request))
   71             else:
   72                 response = dispatch(request, context, action_name)
   73             context.cfg.session_service.finalize(context, context.session)
   74             return response
response undefined, global dispatch = <function dispatch at 0xd885f0>, request = <MoinMoin.web.request.Request object at 0xd8b210>, context = <AllContext ['AllContext']>, action_name = u'AttachFile'
 /usr/lib/python2.5/site-packages/MoinMoin/wsgiapp.py in dispatch(request=<MoinMoin.web.request.Request object at 0xd8b210>, context=<AllContext ['AllContext']>, action_name=u'AttachFile')
  117     # 2. handle action
  118     else:
  119         response = handle_action(context, pagename, action_name)
  120     if isinstance(response, Context):
  121         response = response.request
response undefined, global handle_action = <function handle_action at 0xd887d0>, context = <AllContext ['AllContext']>, pagename = u'ReimarBauer', action_name = u'AttachFile'
 /usr/lib/python2.5/site-packages/MoinMoin/wsgiapp.py in handle_action(context=<AllContext ['AllContext']>, pagename=u'ReimarBauer', action_name=u'AttachFile')
  176             context.page.send_page()
  177         else:
  178             handler(context.page.page_name, context)
  179 
  180     return context
handler = <function execute at 0xd2a500>, context = <AllContext ['AllContext']>, context.page = <MoinMoin.Page.Page object at 0xdd4d90>, context.page.page_name = u'ReimarBauer'
 /usr/lib/python2.5/site-packages/MoinMoin/action/AttachFile.py in execute(pagename=u'ReimarBauer', request=<AllContext ['AllContext']>)
  496     handler = globals().get('_do_%s' % do)
  497     if handler:
  498         msg = handler(pagename, request)
  499     else:
  500         msg = _('Unsupported AttachFile sub-action: %s') % wikiutil.escape(do)
msg undefined, handler = <function _do_view at 0xd2ab90>, pagename = u'ReimarBauer', request = <AllContext ['AllContext']>
 /usr/lib/python2.5/site-packages/MoinMoin/action/AttachFile.py in _do_view(pagename=u'ReimarBauer', request=<AllContext ['AllContext']>)
 1041     # send body
 1042     request.write(request.formatter.startContent())
 1043     send_viewfile(orig_pagename, request)
 1044     send_uploadform(pagename, request)
 1045     request.write(request.formatter.endContent())
global send_viewfile = <function send_viewfile at 0xd2ab18>, orig_pagename = u'ReimarBauer', request = <AllContext ['AllContext']>
 /usr/lib/python2.5/site-packages/MoinMoin/action/AttachFile.py in send_viewfile(pagename=u'ReimarBauer', request=<AllContext ['AllContext']>)
  957     elif mt.major == 'text':
  958         ext = os.path.splitext(filename)[1]
  959         Parser = wikiutil.getParserForExtension(request.cfg, ext)
  960         if Parser is not None:
  961             try:
Parser undefined, global wikiutil = <module 'MoinMoin.wikiutil' from '/usr/lib/python2.5/site-packages/MoinMoin/wikiutil.pyc'>, wikiutil.getParserForExtension = <function getParserForExtension at 0xb69320>, request = <AllContext ['AllContext']>, request.cfg = <wikiconfig.Config object at 0xd9ed90>, ext = u'.py'
 /usr/lib/python2.5/site-packages/MoinMoin/wikiutil.py in getParserForExtension(cfg=<wikiconfig.Config object at 0xd9ed90>, extension=u'.py')
 1259         for pname in getPlugins('parser', cfg):
 1260             try:
 1261                 Parser = importPlugin(cfg, 'parser', pname, 'Parser')
 1262             except PluginMissingError:
 1263                 continue
Parser undefined, global importPlugin = <function importPlugin at 0xb54de8>, cfg = <wikiconfig.Config object at 0xd9ed90>, pname = 'highlight'
 /usr/lib/python2.5/site-packages/MoinMoin/wikiutil.py in importPlugin(cfg=<wikiconfig.Config object at 0xd9ed90>, kind='parser', name='highlight', function='Parser')
 1108         return importWikiPlugin(cfg, kind, name, function)
 1109     except PluginMissingError:
 1110         return importBuiltinPlugin(kind, name, function)
 1111 
 1112 
global importBuiltinPlugin = <function importBuiltinPlugin at 0xb69050>, kind = 'parser', name = 'highlight', function = 'Parser'
 /usr/lib/python2.5/site-packages/MoinMoin/wikiutil.py in importBuiltinPlugin(kind='parser', name='highlight', function='Parser')
 1132         raise PluginMissingError()
 1133     moduleName = 'MoinMoin.%s.%s' % (kind, name)
 1134     return importNameFromPlugin(moduleName, function)
 1135 
 1136 
global importNameFromPlugin = <function importNameFromPlugin at 0xb690c8>, moduleName = 'MoinMoin.parser.highlight', function = 'Parser'
 /usr/lib/python2.5/site-packages/MoinMoin/wikiutil.py in importNameFromPlugin(moduleName='MoinMoin.parser.highlight', name='Parser')
 1145     else:
 1146         fromlist = [name]
 1147     module = __import__(moduleName, globals(), {}, fromlist)
 1148     if fromlist:
 1149         # module has the obj for module <moduleName>
module undefined, builtin __import__ = <built-in function __import__>, moduleName = 'MoinMoin.parser.highlight', builtin globals = <built-in function globals>, fromlist = ['Parser']
 /usr/lib/python2.5/site-packages/MoinMoin/parser/highlight.py in ()
   11 import pygments
   12 import pygments.util
   13 import pygments.lexers
   14 import pygments.formatter
   15 from pygments.token import Token
pygments = None, pygments.lexers undefined

<type 'exceptions.ImportError'>: No module named lexers
      args = ('No module named lexers',)
      message = 'No module named lexers'

traceback.html

We should also not forget to tell the pygments requirement.

Component selection

Details

MoinMoin Version

moin-1.9 4429:574644cfc6d2

OS and Version

Python Version

Server Setup

cgi

Server Details

apache2

Language you are using the wiki in (set in the browser/UserPreferences)

Workaround

Discussion

It works for the standalone server.

Plan


CategoryMoinMoinBugFixed

MoinMoin: MoinMoinBugs/1.9Requires_pygments.lexers (last edited 2011-03-22 12:14:54 by JanuszMordarski)