GAE " no attribute 'HTTPSHandler' " dev_appserver.py - python

I am trying to use the google appengine python SKD from my ubuntu lucid. I have already compiled python2.5. But when I execute any "dev_appserver.py" command with it I get the following error:
Traceback (most recent call last):
File "dev_appserver.py", line 69, in <module>
run_file(__file__, globals())
File "dev_appserver.py", line 65, in run_file
execfile(script_path, globals_)
File "/home/rohan/workspace/app_en/google_appengine/google/appengine/tools/dev_appserver_main.py", line 90, in <module>
from google.appengine.tools import appcfg
File "/media/Ultimate/WebD/django/app_engine/google_appengine/google/appengine/tools/appcfg.py", line 59, in <module>
from google.appengine.tools import appengine_rpc
File "/media/Ultimate/WebD/django/app_engine/google_appengine/google/appengine/tools/appengine_rpc.py", line 24, in <module>
import fancy_urllib
File "/media/Ultimate/WebD/django/app_engine/google_appengine/lib/fancy_urllib/fancy_urllib/__init__.py", line 328, in <module>
class FancyHTTPSHandler(urllib2.HTTPSHandler):
AttributeError: 'module' object has no attribute 'HTTPSHandler'
I have checked the urllib2 moduls of python2.6 and python2.5 but there was no difference in the models defination and HTTPSHandelr is there in python2.5 too. So I guess it is some other sort of error.
I tried to run with the default python2.6 too but then I get the following error:
WARNING 2010-09-11 12:08:40,848 datastore_file_stub.py:657] Could not read datastore data from /tmp/dev_appserver.datastore
Traceback (most recent call last):
File "./dev_appserver.py", line 69, in <module>
run_file(__file__, globals())
File "./dev_appserver.py", line 65, in run_file
execfile(script_path, globals_)
File "/home/rohan/workspace/app_en/google_appengine/google/appengine/tools/dev_appserver_main.py", line 449, in <module>
sys.exit(main(sys.argv))
File "/home/rohan/workspace/app_en/google_appengine/google/appengine/tools/dev_appserver_main.py", line 426, in main
static_caching=static_caching)
File "/home/rohan/workspace/app_en/google_appengine/google/appengine/tools/dev_appserver.py", line 3820, in CreateServer
server = HTTPServerWithScheduler((serve_address, port), handler_class)
File "/home/rohan/workspace/app_en/google_appengine/google/appengine/tools/dev_appserver.py", line 3840, in __init__
request_handler_class)
File "/usr/lib/python2.6/SocketServer.py", line 400, in __init__
self.server_bind()
File "/usr/lib/python2.6/BaseHTTPServer.py", line 108, in server_bind
SocketServer.TCPServer.server_bind(self)
File "/usr/lib/python2.6/SocketServer.py", line 411, in server_bind
self.socket.bind(self.server_address)
File "<string>", line 1, in bind
socket.error: [Errno 98] Address already in use
It works well in windows and even under wine.
Update
Problem with python2.6 solved.
I had configured my apache server for a django deployment on the 8080 and 80 port some time earlier.
But there is still same error with python2.5 isntallation.

Solved the issue...just needed to build all dependencies of python using:
apt-get build-dep python
python compiles with no error even when all the dependencies are not installed. It just skips the modules which require them and builds python.

Solution for missing HTTPSHandler:
Before you build python 2.5 from source you need to enable ssl-socket by editing Modules/Setup.dist (more info here http://paltman.com/2007/nov/15/getting-ssl-support-in-python-251/)

The method described in this post worked perfectly for me (Ubuntu 11.10).
http://dewbot.posterous.com/installation-of-python-25-and-google-app-engi

Related

AttributeError: module 'asyncio.coroutines' has no attribute '_is_coroutine'

I'm deploying a django app made with django channels using nginx, gunicorn and daphne. During deployment when I run python manage.py makemigrations, I get the following error. Could it be because the python version on my local machine was 3.7 and on remote ubuntu server is 3.5?
from cryptography import x509
/home/ubuntu/django/virtualenv2/lib/python3.5/site-packages/OpenSSL/crypto.py:12: CryptographyDeprecationWarning: Python 3.5 support will be dropped in the next release of cryptography. Please upgrade your Python.
from cryptography import x509
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
self.run()
File "/usr/lib/python3.5/threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "/home/ubuntu/django/virtualenv2/lib/python3.5/site-packages/django/utils/autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "/home/ubuntu/django/virtualenv2/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "/home/ubuntu/django/virtualenv2/lib/python3.5/site-packages/django/utils/autoreload.py", line 77, in raise_last_exception
raise _exception[1]
File "/home/ubuntu/django/virtualenv2/lib/python3.5/site-packages/django/core/management/__init__.py", line 337, in execute
autoreload.check_errors(django.setup)()
File "/home/ubuntu/django/virtualenv2/lib/python3.5/site-packages/django/utils/autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "/home/ubuntu/django/virtualenv2/lib/python3.5/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/ubuntu/django/virtualenv2/lib/python3.5/site-packages/django/apps/registry.py", line 122, in populate
app_config.ready()
File "/home/ubuntu/django/virtualenv2/lib/python3.5/site-packages/channels/apps.py", line 20, in ready
monkeypatch_django()
File "/home/ubuntu/django/virtualenv2/lib/python3.5/site-packages/channels/hacks.py", line 10, in monkeypatch_django
from .management.commands.runserver import Command as RunserverCommand
File "/home/ubuntu/django/virtualenv2/lib/python3.5/site-packages/channels/management/commands/runserver.py", line 11, in <module>
from channels.routing import get_default_application
File "/home/ubuntu/django/virtualenv2/lib/python3.5/site-packages/channels/routing.py", line 10, in <module>
from channels.http import AsgiHandler
File "/home/ubuntu/django/virtualenv2/lib/python3.5/site-packages/channels/http.py", line 152, in <module>
class AsgiHandler(base.BaseHandler):
File "/home/ubuntu/django/virtualenv2/lib/python3.5/site-packages/channels/http.py", line 214, in AsgiHandler
#sync_to_async
File "/home/ubuntu/django/virtualenv2/lib/python3.5/site-packages/asgiref/sync.py", line 375, in sync_to_async
return SyncToAsync(func, thread_sensitive=thread_sensitive)
File "/home/ubuntu/django/virtualenv2/lib/python3.5/site-packages/asgiref/sync.py", line 262, in __init__
self._is_coroutine = asyncio.coroutines._is_coroutine
AttributeError: module 'asyncio.coroutines' has no attribute '_is_coroutine'
The error is beacause of asgiref package that uses asyncio.coroutines._is_coroutine attribute since version 3.2.2.
You can install asgiref 3.2.1 and this problem doesn't happen.
pip install asgiref==3.2.1

Cython issue installing scikit-learn

I am trying to run sklearn, which I can import in Python 2.7.11, but
there was an installation problem. I tried going to /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sklearn and ran
python setup.py install
and got into some apparently Cython related issues:
Traceback (most recent call last):
File "setup.py", line 88, in <module>
setup(**configuration(top_path='').todict())
File "setup.py", line 82, in configuration
maybe_cythonize_extensions(top_path, config)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sklearn/_build_utils/__init__.py", line 84, in maybe_cythonize_extensions
config.ext_modules = cythonize(config.ext_modules)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Cython/Build/Dependencies.py", line 908, in cythonize
aliases=aliases)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Cython/Build/Dependencies.py", line 778, in create_extension_list
for file in nonempty(sorted(extended_iglob(filepattern)), "'%s' doesn't match any files" % filepattern):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Cython/Build/Dependencies.py", line 124, in nonempty
raise ValueError(error_msg)
ValueError: '_check_build.pyx' doesn't match any files
Does anyone have an idea as to what the issue might be?
Thanks,

Google AppEngine Python OSError "too many files open" at launch

I'm using ubuntu 13.10 running in a VM on OSX, python2.7 and GAE 1.8.8.
Lauching dev_appserver.py results in the following error:
INFO 2013-12-10 03:53:30,046 api_server.py:527] Saving search indexes
Traceback (most recent call last):
File "/home/ubuntu/xxxxxx/google_appengine/dev_appserver.py", line 197, in <module>
File "/home/ubuntu/xxxxxx/google_appengine/dev_appserver.py", line 193, in _run_file
File "/home/ubuntu/xxxxxx/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 872, in <module>
File "/home/ubuntu/xxxxxx/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 868, in main
File "/home/ubuntu/xxxxxx/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 707, in stop
File "/home/ubuntu/xxxxxx/google_appengine/google/appengine/tools/devappserver2/api_server.py", line 141, in quit
File "/home/ubuntu/xxxxxx/google_appengine/google/appengine/tools/devappserver2/api_server.py", line 528, in cleanup_stubs
File "/home/ubuntu/xxxxxx/google_appengine/google/appengine/api/search/simple_search_stub.py", line 984, in Write
File "/usr/lib/python2.7/tempfile.py", line 304, in mkstemp
File "/usr/lib/python2.7/tempfile.py", line 239, in _mkstemp_inner
OSError: [Errno 24] Too many open files: '/tmp/appengine.xxxxxx-hr-dev.ubuntu/tmpMVVXrH'
Any ideas?
Check the shared memory parameter, kern.sysv.shmseg on your linux system and set it right by increasing it.
To view the shared memory parameters, use:
sysctl -A | grep shm
To update that parameters, edit file:
sudo nano /etc/sysctl.conf
Refer to this SO answer for more information.

Python unit-testing with nose + GAE plugin

Since today morning I'm having some weird problem with Python's unit-testing tool Nose + NoseGAE. I want to run unit-tests for my GAE project in terminal and it ends with this error:
Traceback (most recent call last):
File "/usr/local/bin/nosetests", line 8, in <module>
load_entry_point('nose==1.2.1', 'console_scripts', 'nosetests')()
File "/Library/Python/2.7/site-packages/nose-1.2.1-py2.7.egg/nose/core.py", line 118, in __init__
**extra_args)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/main.py", line 94, in __init__
self.parseArgs(argv)
File "/Library/Python/2.7/site-packages/nose-1.2.1-py2.7.egg/nose/core.py", line 135, in parseArgs
self.config.configure(argv, doc=self.usage())
File "/Library/Python/2.7/site-packages/nose-1.2.1-py2.7.egg/nose/config.py", line 338, in configure
self.plugins.configure(options, self)
File "/Library/Python/2.7/site-packages/nose-1.2.1-py2.7.egg/nose/plugins/manager.py", line 284, in configure
cfg(options, config)
File "/Library/Python/2.7/site-packages/nose-1.2.1-py2.7.egg/nose/plugins/manager.py", line 99, in __call__
return self.call(*arg, **kw)
File "/Library/Python/2.7/site-packages/nose-1.2.1-py2.7.egg/nose/plugins/manager.py", line 167, in simple
result = meth(*arg, **kw)
File "build/bdist.macosx-10.7-intel/egg/nosegae.py", line 84, in configure
File "/usr/local/google_appengine/google/appengine/tools/dev_appserver.py", line 61, in <module>
import simplejson
ImportError: No module named simplejson
It's weird because I'm not even using simplejson anywhere. I know it's part of Django, but I'm not using it either.
OS X 10.7.4
Python 2.7.1
Nose 1.2.1
NoseGAE 0.2.0
Do you have any idea what might be wrong?
This was probably just temporary problem in older GAE on OS X. Newer versions run without any problem.

DjangoAppEngine TestApp

Need some help starting up the djangoappengine testapp.I followed the instructions at http://www.allbuttonspressed.com/projects/djangoappengine, but when I run ./manage.py runserver . while in the project directory I get the following error:
WARNING 2011-03-24 12:23:21,994 datastore_file_stub.py:657] Could not read datastore
data from /media/disk/Projex/AppEngineApp/app/.gaedata/datastore
Error: option --rdbms_sqlite_path not recognized
Runs a development application server for an application.
manage.py [options] <application root>__
When I try and comment the ' 'rdbms_sqlite_path': os.path.join(DATA_ROOT, 'rdbms'),' line in app/djangoappengine/db/base.py I get the following error:
WARNING 2011-03-24 12:26:07,239 datastore_file_stub.py:657] Could not read datastore
data from /media/disk/Projex/AppEngineApp/app/.gaedata/datastore
Traceback (most recent call last):
File "./manage.py", line 11, in <module>
execute_manager(settings)
File "/media/disk/Projex/AppEngineApp/app/django/core/management/__init__.py", line 438,
in execute_manager
utility.execute()
File "/media/disk/Projex/AppEngineApp/app/django/core/management/__init__.py", line 379,
in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File
"/media/disk/Projex/AppEngineApp/app/djangoappengine/management/commands/runserver.py",
line 94, in run_from_argv
start_dev_appserver(argv)
File
"/media/disk/Projex/AppEngineApp/app/djangoappengine/management/commands/runserver.py",
line 81, in start_dev_appserver
dev_appserver_main.main([progname] + args + [PROJECT_DIR])
File "/usr/local/gaepy/google/appengine/tools/dev_appserver_main.py", line 426, in main
static_caching=static_caching)
File "/usr/local/gaepy/google/appengine/tools/dev_appserver.py", line 3820, in
CreateServer
server = HTTPServerWithScheduler((serve_address, port), handler_class)
File "/usr/local/gaepy/google/appengine/tools/dev_appserver.py", line 3840, in __init__
request_handler_class)
File "/usr/lib/python2.6/SocketServer.py", line 400, in __init__
self.server_bind()
File "/usr/lib/python2.6/BaseHTTPServer.py", line 108, in server_bind
SocketServer.TCPServer.server_bind(self)
File "/usr/lib/python2.6/SocketServer.py", line 411, in server_bind
self.socket.bind(self.server_address)
File "<string>", line 1, in bind
socket.gaierror: [Errno -5] No address associated with hostname
Anyone experienced this issue ?
You probably already solved this, but for future users:
The warning can have multiple causes:
data store is empty, in that case ignore
wrong permissions on the datastore files
data corruption issue
The error can be solved by updating djangoappengine
Update to the latest version of google app engine.

Categories

Resources