Path to django on google app engine - google-app-engine

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.

Related

Watson Text to Speech API. Getting invalid syntax in one of the API files

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

odoo ImportError: cannot import name UNALTERABLE_COUNTRIES

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

Pymel OpenMaya dependency?

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]

How to use both Python 2.5 and Python 2.7 with GAE on one PC?

I have GAE projects working with Python 2.5 and Python 2.7. So, I should be able to work with both versions. I've installed 2 versions into different folders (d:\Work\Python25\ and d:\Work\Python27\). What is the easiest way to switch between them?
I've tried to use:
start d:\Work\Python27\python.exe d:\Work\GAE\dev_appserver.py %~dp0
but if fails with the following exception:
Traceback (most recent call last):
File "d:\Work\GAE\dev_appserver.py", line 171, in <module>
run_file(__file__, globals())
File "d:\Work\GAE\dev_appserver.py", line 167, in run_file
execfile(script_path, globals_)
File "d:\Work\GAE\google\appengine\tools\dev_appserver_main.py", line 165, in
<module>
from google.appengine.tools import dev_appserver
File "d:\Work\GAE\google\appengine\tools\dev_appserver.py", line 197, in <modu
le>
mimetypes.add_type(mime_type, '.' + ext)
File "d:\Work\Python27\lib\mimetypes.py", line 344, in add_type
init()
File "d:\Work\Python27\lib\mimetypes.py", line 355, in init
db.read_windows_registry()
File "d:\Work\Python27\lib\mimetypes.py", line 259, in read_windows_registry
for ctype in enum_types(mimedb):
File "d:\Work\Python27\lib\mimetypes.py", line 249, in enum_types
ctype = ctype.encode(default_encoding) # omit in 3.x!
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe0 in position 0: ordinal
not in range(128)
I've never tried this from a Windows PC, but in this situation on Linux, virtualenv is your friend.
The problem I've described is not related to usage of both versions, but python 2.7 issue - https://stackoverflow.com/a/4238212/604388. After fixing it, I am able to work with python 2.7 as described in the question.

Web2py & Google App Engine import errors

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?

Resources