Update: this can now be handled automatically (and more selectively) via an option. See http://wiki.cython.org/DifferencesFromPyrex

Imagine this simple file:

exampleIn.pyx

The generated code is slow though, because range() is slow. I can either manually change all ranges to the "from 1 <= i <= dim -1" idiom, but that's annoying. I prefer Cython to do it automatically (for example by providing a switch "--convertrange" or something, it doesn't have to be default).

Here is a simple script which does that:

--> -->

ImportError

cannot import name wiki

If you want to report a bug, please save this page and attach it to your bug report.

Traceback

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

  1. /home/sage/sage_install/new/local/lib/python2.5/site-packages/MoinMoin/request/__init__.py in run (self=<MoinMoin.request.request_twisted.Request object at 0x44b7250>)

    1. 1305 self.page.send_page()
    2. 1306 else:
    3. 1307 handler(self.page.page_name, self)
    4. 1308
    5. 1309 # every action that didn't use to raise MoinMoinFinish must call this now:
    • handler = <function do_show at 0x256b320>
    • self = <MoinMoin.request.request_twisted.Request object at 0x44b7250>
    • self.page = <MoinMoin.Page.Page object at 0x3d07d10>
    • self.page.page_name = u'RangeFromConverting'
  2. /home/sage/sage_install/new/local/lib/python2.5/site-packages/MoinMoin/action/__init__.py in do_show (pagename=u'RangeFromConverting', request=<MoinMoin.request.request_twisted.Request object at 0x44b7250>, content_only=0, count_hit=1, cacheable=1, print_mode=0)

    1. 251 count_hit=count_hit,
    2. 252 print_mode=print_mode,
    3. 253 content_only=content_only,
    4. 254 )
    5. 255
    • content_only = 0
  3. /home/sage/sage_install/new/local/lib/python2.5/site-packages/MoinMoin/Page.py in send_page (self=<MoinMoin.Page.Page object at 0x3d07b50>, **keywords={'content_only': 0, 'count_hit': 1, 'print_mode': 0})

    1. 1195 format_args=pi['formatargs'],
    2. 1196 do_cache=do_cache,
    3. 1197 start_line=pi['lines'])
    4. 1198
    5. 1199 # check for pending footnotes
    • start_line undefined
    • pi = {'acl': <MoinMoin.security.AccessControlList instance at 0x3a9d368>, 'format': 'jsmath', 'formatargs': '', 'language': 'en', 'lines': 0}
  4. /home/sage/sage_install/new/local/lib/python2.5/site-packages/MoinMoin/Page.py in send_page_content (self=<MoinMoin.Page.Page object at 0x3d07b50>, request=<MoinMoin.request.request_twisted.Request object at 0x44b7250>, body=u'Update: this can now be handled automatically (a...yx\n}}}\n\nproduces:\n\n{{attachment:exampleOut.pyx}}\n', format='jsmath', format_args='', do_cache=1, **kw={'start_line': 0})

    1. 1283 try:
    2. 1284 code = self.loadCache(request)
    3. 1285 self.execute(request, parser, code)
    4. 1286 except Exception, e:
    5. 1287 if not is_cache_exception(e):
    • self = <MoinMoin.Page.Page object at 0x3d07b50>
    • self.execute = <bound method Page.execute of <MoinMoin.Page.Page object at 0x3d07b50>>
    • request = <MoinMoin.request.request_twisted.Request object at 0x44b7250>
    • parser = <wikiconfig.plugin.parser.jsmath.Parser instance at 0x41ad248>
    • code = <code object <module> at 0x4af17b0, file "RangeFromConverting", line 2>
  5. /home/sage/sage_install/new/local/lib/python2.5/site-packages/MoinMoin/Page.py in execute (self=<MoinMoin.Page.Page object at 0x3d07b50>, request=<MoinMoin.request.request_twisted.Request object at 0x44b7250>, parser=<wikiconfig.plugin.parser.jsmath.Parser instance at 0x41ad248>, code=<code object <module> at 0x4af17b0, file "RangeFromConverting", line 2>)

    1. 1314 __file__ = os.path.join(MoinMoin.__loader__.archive, 'dummy')
    2. 1315 try:
    3. 1316 exec code
    4. 1317 except "CacheNeedsUpdate": # convert the exception
    5. 1318 raise Exception("CacheNeedsUpdate")
    • code = <code object <module> at 0x4af17b0, file "RangeFromConverting", line 2>
  6. /home/sage/wiki/cython/sage_wiki/RangeFromConverting in ()

  7. /home/sage/sage_install/new/local/lib/python2.5/site-packages/MoinMoin/formatter/__init__.py in attachment_inlined (self=<MoinMoin.formatter.text_html.Formatter instance at 0x3a9d248>, url=u'convertRange.py', text=u'convertRange.py', **kw={})

    1. 133 fpath = AttachFile.getFilename(self.request, pagename, fname)
    2. 134 ext = os.path.splitext(filename)[1]
    3. 135 Parser = wikiutil.getParserForExtension(self.request.cfg, ext)
    4. 136 if Parser is not None:
    5. 137 try:
    • Parser undefined
    • global wikiutil = <module 'MoinMoin.wikiutil' from '/home/sage/sag...b/python2.5/site-packages/MoinMoin/wikiutil.pyc'>
    • wikiutil.getParserForExtension = <function getParserForExtension at 0x23ab938>
    • self = <MoinMoin.formatter.text_html.Formatter instance at 0x3a9d248>
    • self.request = <MoinMoin.request.request_twisted.Request object at 0x44b7250>
    • self.request.cfg = <wikiconfig.Config object at 0x24b9c10>
    • ext = u'.py'
  8. /home/sage/sage_install/new/local/lib/python2.5/site-packages/MoinMoin/wikiutil.py in getParserForExtension (cfg=<wikiconfig.Config object at 0x24b9c10>, extension=u'.py')

    1. 1250 for pname in getPlugins('parser', cfg):
    2. 1251 try:
    3. 1252 Parser = importPlugin(cfg, 'parser', pname, 'Parser')
    4. 1253 except PluginMissingError:
    5. 1254 continue
    • Parser = <class MoinMoin.parser.text_xslt.Parser at 0x3182dd0>
    • global importPlugin = <function importPlugin at 0x23ab140>
    • cfg = <wikiconfig.Config object at 0x24b9c10>
    • pname = 'inline_latex'
  9. /home/sage/sage_install/new/local/lib/python2.5/site-packages/MoinMoin/wikiutil.py in importPlugin (cfg=<wikiconfig.Config object at 0x24b9c10>, kind='parser', name='inline_latex', function='Parser')

    1. 1105 """
    2. 1106 try:
    3. 1107 return importWikiPlugin(cfg, kind, name, function)
    4. 1108 except PluginMissingError:
    5. 1109 return importBuiltinPlugin(kind, name, function)
    • global importWikiPlugin = <function importWikiPlugin at 0x23ab5f0>
    • cfg = <wikiconfig.Config object at 0x24b9c10>
    • kind = 'parser'
    • name = 'inline_latex'
    • function = 'Parser'
  10. /home/sage/sage_install/new/local/lib/python2.5/site-packages/MoinMoin/wikiutil.py in importWikiPlugin (cfg=<wikiconfig.Config object at 0x24b9c10>, kind='parser', name='inline_latex', function='Parser')

    1. 1118 raise PluginMissingError
    2. 1119 moduleName = '%s.plugin.%s.%s' % (cfg.siteid, kind, name)
    3. 1120 return importNameFromPlugin(moduleName, function)
    4. 1121
    5. 1122
    • global importNameFromPlugin = <function importNameFromPlugin at 0x23ab6e0>
    • moduleName = 'wikiconfig.plugin.parser.inline_latex'
    • function = 'Parser'
  11. /home/sage/sage_install/new/local/lib/python2.5/site-packages/MoinMoin/wikiutil.py in importNameFromPlugin (moduleName='wikiconfig.plugin.parser.inline_latex', name='Parser')

    1. 1142 else:
    2. 1143 fromlist = [name]
    3. 1144 module = __import__(moduleName, globals(), {}, fromlist)
    4. 1145 if fromlist:
    5. 1146 # module has the obj for module <moduleName>
    • module undefined
    • builtin __import__ = <built-in function __import__>
    • moduleName = 'wikiconfig.plugin.parser.inline_latex'
    • builtin globals = <built-in function globals>
    • fromlist = ['Parser']
  12. /home/sage/wiki/cython/sage_wiki/data/plugin/parser/inline_latex.py in ()

    1. 13 """
    2. 14
    3. 15 from MoinMoin.parser import wiki
    4. 16 from MoinMoin import wikiutil
    5. 17
    • MoinMoin undefined
    • wiki undefined

ImportError

cannot import name wiki

  • args = ('cannot import name wiki',)
  • message = 'cannot import name wiki'

System Details

  • Date: Mon, 22 Mar 2010 02:48:30 +0000
  • Platform: Linux sagemath 2.6.28-18-server #59-Ubuntu SMP Thu Jan 28 02:25:03 UTC 2010 x86_64
  • Python: Python 2.5.2 (/home/sage/sage_install/new/local/bin/python)
  • MoinMoin: Release 1.7.2 (release)