Hi I am using the numba just in time compiler (version 0.16) for speeding up numerical calculations under python.
For testing it I have slightly modified the standard web2py welcome application such that the index controller function calls a tiny function numba_add which adds 2 numbers. from numba import * #@jit def numba_add(x,y): z=x+y return z def index(): """ example action using the internationalization operator T and flash rendered by views/default/index.html or views/generic.html if you need a simple wiki simply replace the two lines below with: return auth.wiki() """ response.flash = T("7+4={}".format(numba_add(7.0,4.0))) return dict(message=T('Hello World {}'.format(numba_add(7.0,4.0)))) When running it, numba is imported and if I comment out the @jit decorator the application works well. However if I use the @jit decorator to compile it I get the error ticket below. Does anyone have a clue what could be wrong. I have now idea what the error message means. Leo Haimberger Error ticket for "welcome"Ticket ID 131.130.157.11.2015-01-15.10-57-59.c400457e-a478-49cf-b014-acde33d01266 <type 'exceptions.KeyError'> "Failed at object mode backend\n'__restricted__'"Versionweb2py™Version 2.9.11-stable+timestamp.2014.09.15.23.35.11Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. Traceback (most recent call last): File "/fio/srvx7/leo/python/web2py/gluon/restricted.py", line 224, in restricted exec ccode in environment File "/fio/srvx7/leo/python/web2py/applications/welcome/controllers/default.py" <http://localhost:8000/admin/default/edit/welcome/controllers/default.py>, line 79, in <module> File "/fio/srvx7/leo/python/web2py/gluon/globals.py", line 392, in <lambda> self._caller = lambda f: f() File "/fio/srvx7/leo/python/web2py/applications/welcome/controllers/default.py" <http://localhost:8000/admin/default/edit/welcome/controllers/default.py>, line 26, in index response.flash = T("7+4={}".format(numba_add(7.0,4.0))) File "/opt/anaconda/lib/python2.7/site-packages/numba-0.16.0-py2.7-linux-x86_64.egg/numba/dispatcher.py", line 153, in _compile_for_args return self.jit(sig) File "/opt/anaconda/lib/python2.7/site-packages/numba-0.16.0-py2.7-linux-x86_64.egg/numba/dispatcher.py", line 144, in jit return self.compile(sig, **kws) File "/opt/anaconda/lib/python2.7/site-packages/numba-0.16.0-py2.7-linux-x86_64.egg/numba/dispatcher.py", line 279, in compile flags=flags, locals=locs) File "/opt/anaconda/lib/python2.7/site-packages/numba-0.16.0-py2.7-linux-x86_64.egg/numba/compiler.py", line 552, in compile_extra return pipeline.compile_extra(func) File "/opt/anaconda/lib/python2.7/site-packages/numba-0.16.0-py2.7-linux-x86_64.egg/numba/compiler.py", line 263, in compile_extra return self.compile_bytecode(res.result, func_attr=self.func_attr) File "/opt/anaconda/lib/python2.7/site-packages/numba-0.16.0-py2.7-linux-x86_64.egg/numba/compiler.py", line 275, in compile_bytecode return self._compile_bytecode() File "/opt/anaconda/lib/python2.7/site-packages/numba-0.16.0-py2.7-linux-x86_64.egg/numba/compiler.py", line 501, in _compile_bytecode return self._run_pipeline(pipelines) File "/opt/anaconda/lib/python2.7/site-packages/numba-0.16.0-py2.7-linux-x86_64.egg/numba/compiler.py", line 526, in _run_pipeline raise _raise_error(msg, res.exception) KeyError: "Failed at object mode backend\n'__restricted__'" In file: /fio/srvx7/leo/python/web2py/applications/welcome/controllers/default.py 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. # -*- coding: utf-8 -*- # this file is released under public domain and you can use without limitations ######################################################################### ## This is a sample controller ## - index is the default action of any application ## - user is required for authentication and authorization ## - download is for downloading files uploaded in the db (does streaming) ## - api is an example of Hypermedia API support and access control ######################################################################### from numba import * @jit def numba_add(x,y): z=x+y return z def index(): """ example action using the internationalization operator T and flash rendered by views/default/index.html or views/generic.html if you need a simple wiki simply replace the two lines below with: return auth.wiki() """ response <http://localhost:8000/examples/global/vars/response>.flash = T <http://localhost:8000/examples/global/vars/T>("7+4={}".format(numba_add(7.0,4.0))) return dict(message=T <http://localhost:8000/examples/global/vars/T>('Hello World {}'.format(numba_add(7.0,4.0)))) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.