I tried to start web2py 1.98.1 using dev_appserver.py, but it cannot
find the "pickle" module.
Traceback (most recent call last): File
"/home/matthew/dev/sdks/google_appengine_1.5.2/google/appengine/
tools/dev_appserver.py", line 4144, in _HandleRequest
self._Dispatch(dispatcher, self.rfile, outfile, env_dict)
File "/home/matthew/dev/sdks/google_appengine_1.5.2/google/appengine/
tools/dev_appserver.py", line 4049, in _Dispatch
base_env_dict=env_dict) File
"/home/matthew/dev/sdks/google_appengine_1.5.2/google/appengine/
tools/dev_appserver.py", line 616, in Dispatch
base_env_dict=base_env_dict) File
"/home/matthew/dev/sdks/google_appengine_1.5.2/google/appengine/
tools/dev_appserver.py", line 3120, in Dispatch
self._module_dict) File
"/home/matthew/dev/sdks/google_appengine_1.5.2/google/appengine/
tools/dev_appserver.py", line 3024, in ExecuteCGI
reset_modules = exec_script(handler_path, cgi_path, hook)
File "/home/matthew/dev/sdks/google_appengine_1.5.2/google/appengine/
tools/dev_appserver.py", line 2887, in ExecuteOrImportScript
exec module_code in script_module.dict File
"/home/matthew/dev/projects/poprop_cameron/project/src/
gaehandler.py", line 33, in
import pickle ImportError: No module named pickle
When I import it using the interpreter, it imports without error. Is
there a path I have to include somewhere?
Related
I'm using Python 2.7.15 and I'm getting this message about one of the API files.
Any ideas as to what is going on.
Traceback (most recent call last):
File "text_to_speech_v1.py", line 4, in <module>
from ibm_watson import TextToSpeechV1
File "/usr/local/lib/python2.7/dist-packages/ibm_watson/__init__.py", line 16, in <module>
from ibm_cloud_sdk_core import IAMTokenManager, DetailedResponse, BaseService, ApiException
File "/usr/local/lib/python2.7/dist-packages/ibm_cloud_sdk_core/__init__.py", line 16, in <module>
from .base_service import BaseService
File "/usr/local/lib/python2.7/dist-packages/ibm_cloud_sdk_core/base_service.py", line 136
response = requests.request(**request, cookies=self.jar, **kwargs)
SyntaxError: invalid syntax
I'm facing an error while I select a new db in localhost.
First an Internal Server Error Screen comes then when I reload the page,the page will come.
But because of this error we can't view the code in Edit Form View and many other problems like we can't edit the reports.
I think this is because of some missing packages.If anyone has a list of what all packages to be installed for the correct working or any other methods to resolve this issue,
Please help..
Error Log
ERROR ? werkzeug: Error on request:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/werkzeug/serving.py", line 270, in run_wsgi
execute(self.server.app)
File "/usr/local/lib/python2.7/dist-packages/werkzeug/serving.py", line 258, in execute
application_iter = app(environ, start_response)
File "/home/orchid/Documents/client_projects/Aasons/live/live/odoo/odoo/service/server.py", line 250, in app
return self.app(e, s)
File "/home/orchid/Documents/client_projects/Aasons/live/live/odoo/odoo/service/wsgi_server.py", line 184, in application
return application_unproxied(environ, start_response)
File "/home/orchid/Documents/client_projects/Aasons/live/live/odoo/odoo/service/wsgi_server.py", line 170, in application_unproxied
result = handler(environ, start_response)
File "/home/orchid/Documents/client_projects/Aasons/live/live/odoo/odoo/http.py", line 1307, in call
self.load_addons()
File "/home/orchid/Documents/client_projects/Aasons/live/live/odoo/odoo/http.py", line 1328, in load_addons
m = import('odoo.addons.' + module)
File "/home/orchid/Documents/client_projects/Aasons/live/live/odoo/odoo/modules/module.py", line 81, in load_module
execfile(modfile, new_mod.dict)
File "/usr/lib/python2.7/dist-packages/odoo/addons/l10n_fr_pos_cert/init.py", line 6, in
from ..l10n_fr_certification.models.res_company import UNALTERABLE_COUNTRIES
ImportError: cannot import name UNALTERABLE_COUNTRIES
Where can I get the Open dependency for pymel? I do not see anywhere in the docs where this is stated
Traceback (most recent call last):
File "test.py", line 1, in <module>
import pymel.core
File "/Users/kromah/Documents/Developer/Github/pymel/pymel/core/__init__.py", line 6, in <module>
import pymel.versions as _versions
File "/Users/kromah/Documents/Developer/Github/pymel/pymel/versions.py", line 13, in <module> from maya.OpenMaya import MGlobal as _MGlobal
[ImportError: No module named OpenMaya]
My directory structure in app engine is like this :
project
app.yaml
main.py
lib
markdown
markdown_files
Markdown is being imported in main.py by from lib.markdown import markdown . At this point dev server is starting to give me the following stack trace. I am wondering what's going wrong here !? I do have an init.py in lib.
Traceback (most recent call last):
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 2769, in _HandleRequest
self._Dispatch(dispatcher, self.rfile, outfile, env_dict)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 2654, in _Dispatch
base_env_dict=env_dict)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 683, in Dispatch
base_env_dict=base_env_dict)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 1718, in Dispatch
self._module_dict)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 1622, in ExecuteCGI
reset_modules = exec_script(config, handler_path, cgi_path, hook)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 1310, in ExecuteOrImportScript
exec module_code in script_module.__dict__
File "/Users/nomadali/jeeqs/git/src/jeeqs.py", line 26, in <module>
from lib.markdown import markdown
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 676, in Decorate
return func(self, *args, **kwargs)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 1845, in load_module
return self.FindAndLoadModule(submodule, fullname, search_path)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 676, in Decorate
return func(self, *args, **kwargs)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 1717, in FindAndLoadModule
description)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 676, in Decorate
return func(self, *args, **kwargs)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 1660, in LoadModuleRestricted
description)
File "/Users/nomadali/jeeqs/git/src/lib/markdown/__init__.py", line 161, in <module>
import preprocessors
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 676, in Decorate
return func(self, *args, **kwargs)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 1845, in load_module
return self.FindAndLoadModule(submodule, fullname, search_path)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 676, in Decorate
return func(self, *args, **kwargs)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 1717, in FindAndLoadModule
description)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 676, in Decorate
return func(self, *args, **kwargs)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 1660, in LoadModuleRestricted
description)
File "/Users/nomadali/jeeqs/git/src/markdown/preprocessors.py", line 11, in <module>
ImportError: No module named markdown
INFO 2012-02-20 19:53:02,506 dev_appserver.py:2884] "GET /favicon.ico HTTP/1.0" 500 -
Update1
I believe this question is a dupe of Import Python module with PyImport_ImportModuleEx for a gedit plugin
The answer:
If you want to use markdown without modifying it then you're going to have to put it somewhere where the Python library expects it, such as in site-packages/. Otherwise, you will have to modify it to use relative imports instead of absolute imports.
Update 2
I resolved this issue by modifying my sys.path in app engine:
sys.path.append(os.path.join(os.path.dirname(file), 'lib'))
Thanks to Murat for help,
I believe this question is a dupe of Import Python module with PyImport_ImportModuleEx for a gedit plugin
The answer:
If you want to use markdown without modifying it then you're going to have to put it somewhere where the Python library expects it, such as in site-packages/. Otherwise, you will have to modify it to use relative imports instead of absolute imports.
Update 2 I resolved this issue by modifying my sys.path in app engine:
sys.path.append(os.path.join(os.path.dirname(file), 'lib'))
Thanks to Murat for help,
The file needs to be called __init__.py for that to work.
Adding the lib directory to the pythonpath also works.
If you want to use markdown without modifying it then you're going to have to put it somewhere where the Python library expects it, such as in site-packages/
This is incorrect, app engine has its own import mechanism and only packages that are explicitly white listed are allowed to be imported via this method.
What you want is for lib to be in your PYTHONPATH, the paths where Python looks stuff that you try to import. As you've discovered, one way to do that is to add lib to sys.path.
Creating an init.py file is not what you want, because that makes lib a package containing markdown. At that point, you should be able to do
from lib import markdown
although that's not the recommended way to do it.
I completely don't understand this error. I use django-nonrel, upload it to my application by manage.py. And sometimes I have this:
<type 'exceptions.AttributeError'>: 'Settings' object has no attribute 'DATABASE_ROUTERS'
Traceback (most recent call last):
File "/base/data/home/apps/appid/3.347077242893060339/execute.py", line 2, in <module>
from djapp import queue_controller
File "/base/data/home/apps/appid/3.347077242893060339/djapp/queue_controller.py", line 5, in <module>
from djapp.models import Operation
File "/base/data/home/apps/appid/3.347077242893060339/djapp/models.py", line 3, in <module>
from django.db import models
File "/base/data/home/apps/appid/3.347077242893060339/django/db/__init__.py", line 66, in <module>
router = ConnectionRouter(settings.DATABASE_ROUTERS)
File "/base/python_runtime/python_lib/versions/third_party/django-0.96/django/conf/__init__.py", line 32, in __getattr__
return getattr(self._target, name)
or
<type 'exceptions.ImportError'>: No module named files.uploadhandler
Traceback (most recent call last):
File "/base/data/home/apps/appid/3.347067228745038183/djangoappengine/main/main.py", line 28, in <module>
from django.core.handlers.wsgi import WSGIHandler
File "/base/python_runtime/python_lib/versions/third_party/django-0.96/django/core/handlers/wsgi.py", line 1, in <module>
from django.core.handlers.base import BaseHandler
File "/base/python_runtime/python_lib/versions/third_party/django-0.96/django/core/handlers/base.py", line 3, in <module>
from django import http
File "/base/data/home/apps/appid/3.347067228745038183/django/http/__init__.py", line 28, in <module>
from django.http.multipartparser import MultiPartParser
File "/base/data/home/apps/appid/3.347067228745038183/django/http/multipartparser.py", line 14, in <module>
from django.core.files.uploadhandler import StopUpload, SkipFile, StopFutureHandlers
What is wrong with the path? Why does this happen? At first the path is "/base/data/home/apps/app-id/3.347046818251769742/django/", then it is "/base/python_runtime/python_lib/versions/third_party/django-0.96/django/".
And how to avoid this error?
I have checked sys.path, uploaded new django several times, removed all unnecessary files, I am lost :(
sys.path = ['/base/data/home/apps/appid/3.347077364008022180',
'/base/data/home/apps/appid/3.347077364008022180/djangoappengine/lib',
'/base/python_runtime/python_dist/lib/python25.zip',
'/base/python_runtime/python_dist/lib/python2.5/',
'/base/python_runtime/python_dist/lib/python2.5/plat-linux2',
'/base/python_runtime/python_dist/lib/python2.5/lib-tk',
'/base/python_runtime/python_dist/lib/python2.5/lib-dynload',
'/base/python_runtime/python_lib/versions/1',
'/base/data/home/apps/appid/3.347077364008022180/']
I guess that db/__init__.py does something like from django.conf import Settings, and for whatever reason, it's sometimes being given the system's version of Django rather than your own.
You could try changing it to use a relative import, like from ..conf import Settings, which should mean it uses the version in the same package as itself. That works from Python 2.5, which is what Appengine uses.