I am using Web2PY version 2.14.6 on a Mac OS X. I have installed jsonrpc and pyeapi modules using pip and they are located in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ folder. I can use import os without any issues but when I try to import jsonrpc or pyeapi, it gives the error that it cannot import the module. I can run command line code and import the modules, so not a permissions thing. Any help would be appreciated.
Version web2py™ Version 2.14.6-stable+timestamp.2016.05.10.00.21.47 Python Python 2.7.3: /Applications/web2py.app/Contents/MacOS/python (prefix: /Applications/web2py.app/Contents/Resources)Traceback 1. 2. 3. 4. 5. 6. Traceback (most recent call last): File "/Applications/web2py.app/Contents/Resources/gluon/restricted.py", line 227, in restricted File "/Applications/web2py.app/Contents/Resources/applications/Arista_EOS_Tools/controllers/default.py" <http://64.89.178.12:8000/admin/default/edit/Arista_EOS_Tools/controllers/default.py>, line 13, in <module> File "/Applications/web2py.app/Contents/Resources/gluon/custom_import.py", line 89, in custom_importer ImportError: Cannot import module 'applications.Arista_EOS_Tools.modules.jsonrpc' Error snapshot [image: help] <http://64.89.178.12:8000/admin/default/ticket/Arista_EOS_Tools/64.89.178.12.2017-06-08.07-42-57.5bd271f2-706a-4736-8d5e-afb153efc3ce#> <type 'exceptions.ImportError'>(Cannot import module 'applications.Arista_EOS_Tools.modules.jsonrpc') inspect attributes Frames - *File /Applications/web2py.app/Contents/Resources/gluon/restricted.py in restricted at line 227* code arguments variables - *File /Applications/web2py.app/Contents/Resources/applications/Arista_EOS_Tools/controllers/default.py in <module> at line 13* code arguments variables - *File /Applications/web2py.app/Contents/Resources/gluon/custom_import.py in custom_importer at line 89* code arguments variables Function argument list (name='jsonrpc', globals={'A': <class 'gluon.html.A'>, 'ANY_OF': <class 'gluon.validators.ANY_OF'>, 'ASSIGNJS': <function ASSIGNJS>, 'AppConfig': <function AppConfig>, 'Auth': <class 'gluon.tools.Auth'>, 'B': <class 'gluon.html.B'>, 'BEAUTIFY': <class 'gluon.html.BEAUTIFY'>, 'BODY': <class 'gluon.html.BODY'>, 'BR': <class 'gluon.html.BR'>, 'BUTTON': <class 'gluon.html.BUTTON'>, ...}, locals={'A': <class 'gluon.html.A'>, 'ANY_OF': <class 'gluon.validators.ANY_OF'>, 'ASSIGNJS': <function ASSIGNJS>, 'AppConfig': <function AppConfig>, 'Auth': <class 'gluon.tools.Auth'>, 'B': <class 'gluon.html.B'>, 'BEAUTIFY': <class 'gluon.html.BEAUTIFY'>, 'BODY': <class 'gluon.html.BODY'>, 'BR': <class 'gluon.html.BR'>, 'BUTTON': <class 'gluon.html.BUTTON'>, ...}, fromlist=[], level=-1) Code listing 84. 85. 86. 87. 88. 89. 90. 91. 92. 93. new_mod = base_importer( modules_prefix, globals, locals, [itemname], level) try: result = result or sys.modules[modules_prefix+'.'+itemname] except KeyError, e: raise ImportError, 'Cannot import module %s' % str(e) modules_prefix += "." + itemname return result else: # import like "from x import a, b, ..." Variables Context locals request session response In file: /Applications/web2py.app/Contents/Resources/applications/Arista_EOS_Tools/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. # -*- 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) # ------------------------------------------------------------------------- import os print (os.environ['PYTHONPATH']) import jsonrpc import pyeapi 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() """ return dict(message=T <http://64.89.178.12:8000/examples/global/vars/T>('Arista EOS Tools')) def add_inventory(): form = SQLFORM <http://64.89.178.12:8000/examples/global/vars/SQLFORM>.factory( Field <http://64.89.178.12:8000/examples/global/vars/Field>('username', requires=IS_NOT_EMPTY <http://64.89.178.12:8000/examples/global/vars/IS_NOT_EMPTY>()), Field <http://64.89.178.12:8000/examples/global/vars/Field>('password', 'password', requires=IS_NOT_EMPTY <http://64.89.178.12:8000/examples/global/vars/IS_NOT_EMPTY>()), Field <http://64.89.178.12:8000/examples/global/vars/Field>('switchip', 'text', label="Switch IPs")) return dict(form=form) response <http://64.89.178.12:8000/examples/global/vars/response>._vars=response <http://64.89.178.12:8000/examples/global/vars/response>._caller(add_inventory) -- 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.