File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "/Library/Python/2.7/site-packages/dj_static.py", line 83, in __call__
return self.application(environ, start_response)
File "/Library/Python/2.7/site-packages/django/core/handlers/wsgi.py", line 255, in __call__
response = self.get_response(request)
File "/Library/Python/2.7/site-packages/django/core/handlers/base.py", line 178, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "/Library/Python/2.7/site-packages/django/core/handlers/base.py", line 220, in handle_uncaught_exception
if resolver.urlconf_module is None:
File "/Library/Python/2.7/site-packages/django/core/urlresolvers.py", line 342, in urlconf_module
self._urlconf_module = import_module(self.urlconf_name)
File "/Library/Python/2.7/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/Users/WillRedington/Desktop/Django Projects/propadev/propvocab/urls.py", line 3, in <module>
from rest_framework import routers
File "/Library/Python/2.7/site-packages/rest_framework/routers.py", line 23, in <module>
from rest_framework import views
File "/Library/Python/2.7/site-packages/rest_framework/views.py", line 11, in <module>
from rest_framework.compat import HttpResponseBase, View
File "/Library/Python/2.7/site-packages/rest_framework/compat.py", line 13, in <module>
from django.utils.six.moves.urllib import parse as urlparse
ImportError: No module named urllib
The server error message: [17/Dec/2014 16:26:45] "GET / HTTP/1.1" 500 59
This is checking if python returns the modules:
>>> import django.utils.six.moves
>>> import django.utils.six.moves.urllib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named urllib
>>>
My current python version is 2.7.2, Django is 1.5.1, rest framework is in 2.7 site-package.
I have already tried uninstalling and reinstalling Django several times and get the same error.
This is running on Mac OS X 10.9.5, please help me, I've been at this for 5 hours.
it seems like a dependency error. Maybe you downgraded your django, or randomly installed the rest framework package without controlling the dependencies.
django.utils.six.moves.urllib doesnt exist in django==1.5.1 yet. You can try to upgrade django to 1.5.7 for example. Then this import will work. Other things might still be broken though, I can´t tell from here. If you post the output of pip freeze here, it may be easier to help.
You aren´t working in a virtual environment, which is dangerous for dependencies. Best is to make a virtualenv, then install your packages with pip, taking care of dependencies.
Then run:
pip freeze > requirements.txt
and use that file in the future like this:
pip install -r requirements.txt
and edit the file accordingly if you install, update or remove packages.
Something that might be of interest is this: it generally never works to uninstall and reinstall the same package several times; if it doesn´t work once, it won´t work the second time either.
As someone mentioned before my response wasn't really an answer. I solved this error and potentially many more by installing a python virtual environment. To do this run the following
sudo pip install virtualenv
Then create a new folder for your virtual environments. cd into the created folder.
cd myvirtualenv
Then create a new virtual environment by running the following:
virtualenv venv
To run the virtual env:
source venv/bin/activate
This makes a seperate environment with it's own site packages, which is essential for any python developer, especially when working on multiple projects.
Source: http://docs.python-guide.org/en/latest/dev/virtualenvs/
Related
I've downloaded the pythonanywhere installation tool and am trying to deploy with the following line:
pa_autoconfigure_django.py <https://github.com/myusername/myproject.git>
Then, I get this a key error. My project runs on local.
File "/projects/hosproject/venv/lib/python3.7/site-packages/pythonanywhere/project.py", line 16, in __init__
self.virtualenv = Virtualenv(self.domain, self.python_version)
File "/projects/hosproject/venv/lib/python3.7/site-packages/pythonanywhere/virtualenvs.py", line 12, in __init__
self.path = Path(os.environ["WORKON_HOME"]) / domain
File "/projects/hosproject/venv/bin/../lib/python3.7/os.py", line 678, in __getitem__
raise KeyError(key) from None
KeyError: 'WORKON_HOME'
Need some help to debug this and try to deploy again. If it helps, I'm new to Django and following this tutorial: https://tutorial.djangogirls.org/en/deploy/.
As noted by Giles:
It looks like you might be running the PythonAnywhere tools from a terminal on your own machine -- you should run it in a bash console on PythonAnywhere -- you can start one from the "Consoles" page. (emphasis mine)
However I only got to this KeyError: WORKON_HOME after running several commands I shouldn't have (at least it'll make clean up easier):
$ pip3 install --user pythonanywhere
$ pa_autoconfigure_django.py --python=3.7 git#github.com:pzrq/djangogirls-tutorial-blog.git
-bash: pa_autoconfigure_django.py: command not found
$ find / -name "pa_autoconfigure_django.py"
$ /Users/pzrq/Library/Python/3.7/bin/pa_autoconfigure_django.py --python=3.7 git#github.com:pzrq/djangogirls-tutorial-blog.git
Traceback (most recent call last):
File "/Users/pzrq/Library/Python/3.7/bin/pa_autoconfigure_django.py", line 19, in <module>
from docopt import docopt
ModuleNotFoundError: No module named 'docopt'
$ pip install docopt
...
$ /Users/pzrq/Library/Python/3.7/bin/pa_autoconfigure_django.py --python=3.7 git#github.com:pzrq/djangogirls-tutorial-blog.git
...
ModuleNotFoundError: No module named 'pythonanywhere'
$ pip install pythonanywhere
...
$ /Users/pzrq/Library/Python/3.7/bin/pa_autoconfigure_django.py --python=3.7 git#github.com:pzrq/djangogirls-tutorial-blog.git
Traceback (most recent call last):
File "/Users/pzrq/Library/Python/3.7/bin/pa_autoconfigure_django.py", line 52, in <module>
main(arguments['<git-repo-url>'], arguments['--domain'], arguments['--python'], nuke=arguments.get('--nuke'))
File "/Users/pzrq/Library/Python/3.7/bin/pa_autoconfigure_django.py", line 33, in main
project = DjangoProject(domain, python_version)
File "/Users/pzrq/Projects/djangogirls/myvenv/lib/python3.7/site-packages/pythonanywhere/project.py", line 16, in __init__
self.virtualenv = Virtualenv(self.domain, self.python_version)
File "/Users/pzrq/Projects/djangogirls/myvenv/lib/python3.7/site-packages/pythonanywhere/virtualenvs.py", line 12, in __init__
self.path = Path(os.environ["WORKON_HOME"]) / domain
File "/usr/local/bin/../Cellar/python/3.7.3/bin/../Frameworks/Python.framework/Versions/3.7/lib/python3.7/os.py", line 678, in __getitem__
raise KeyError(key) from None
KeyError: 'WORKON_HOME'
I am trying to implement firebase functions cron job from this link : https://github.com/firebase/functions-cron
Everything worked properly
But when I try to run google cloud cron job it gives me below error :
(/base/alloc/tmpfs/dynamic_runtimes/python27/c5586dbb532f7e5f_unzipped/python27_lib/versions/1/google/appengine/runtime/wsgi.py:263)
Traceback (most recent call last):
File "/base/alloc/tmpfs/dynamic_runtimes/python27/c5586dbb532f7e5f_unzipped/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/base/alloc/tmpfs/dynamic_runtimes/python27/c5586dbb532f7e5f_unzipped/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/base/alloc/tmpfs/dynamic_runtimes/python27/c5586dbb532f7e5f_unzipped/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 85, in LoadObject
obj = __import__(path[0])
File "/base/data/home/apps/s~debitcredit-7ecc0/20180506t121449.409523654918066893/main.py", line 18, in <module>
import pubsub_utils
File "/base/data/home/apps/s~debitcredit-7ecc0/20180506t121449.409523654918066893/pubsub_utils.py", line 24, in <module>
import oauth2client.contrib.appengine as gae_oauth2client
File "./lib/oauth2client/contrib/appengine.py", line 36, in <module>
from oauth2client import client
File "./lib/oauth2client/client.py", line 39, in <module>
from oauth2client import transport
File "./lib/oauth2client/transport.py", line 255, in <module>
redirections=httplib2.DEFAULT_MAX_REDIRECTS,
AttributeError: 'module' object has no attribute 'DEFAULT_MAX_REDIRECTS'
I tried this solution : Getting AttributeError: 'module' object has no attribute 'DEFAULT_MAX_REDIRECTS' when running Google Sheets API quickstart
But still no luck.
Can anyone please help me with this.
Issue is with your httplib Module.
When you installed this module for your project you must have installed it with pip for Python 3
If you want to check whether this module is for python 3 or python 2,
Go to httplib2 module and go inside its init.py
later see this line Requires Python 3 or later
if it is written like that means you have installed this library with pip for python 3. Now delete all the httplib2 from your lib folder.
Create a seperate enviroment for python 2.7 and again install all your modules with pip install -t lib -r requirements.txt
I'm trying to install the CKAN ckanext-spatial plugin by following the step-by-step instructions listed below.
http://docs.ckan.org/projects/ckanext-spatial/en/latest/install.html#ubuntu-12-04-postgresql-9-1-and-postgis-1-5
After installation and configuration, I get the following apache server error when trying to access the site homepage. CKAN is currently unusable. Do I need to upgrade the version of GeoAlchemy or is this an issue with the extension?
mod_wsgi (pid=29881): Target WSGI script '/etc/ckan/default/apache.wsgi' cannot be loaded as Python module.
mod_wsgi (pid=29881): Exception occurred processing WSGI script '/etc/ckan/default/apache.wsgi'.
Traceback (most recent call last):
File "/etc/ckan/default/apache.wsgi", line 10, in
application = loadapp('config:%s' % config_filepath)
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
return loadobj(APP, uri, name=name, **kw)
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 271, in loadobj
global_conf=global_conf)
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 296, in loadcontext
global_conf=global_conf)
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 320, in _loadconfig
return loader.get_context(object_type, name, global_conf)
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 454, in get_context
section)
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 476, in _context_from_use
object_type, name=use, global_conf=global_conf)
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 406, in get_context
global_conf=global_conf)
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 296, in loadcontext
global_conf=global_conf)
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 328, in _loadegg
return loader.get_context(object_type, name, global_conf)
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 620, in get_context
object_type, name=name)
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 646, in find_egg_entry_point
possible.append((entry.load(), protocol, entry.name))
File "/usr/lib/ckan/default/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/pkg_resources.py", line 1989, in load
entry = import(self.module_name, globals(),globals(), ['name'])
File "/usr/lib/ckan/default/src/ckan/ckan/config/middleware.py", line 26, in
from ckan.config.environment import load_environment
File "/usr/lib/ckan/default/src/ckan/ckan/config/environment.py", line 17, in
import ckan.model as model
File "/usr/lib/ckan/default/src/ckan/ckan/model/init.py", line 7, in
import vdm.sqlalchemy
File "/usr/lib/ckan/default/lib/python2.7/site-packages/vdm/sqlalchemy/init.py", line 32, in
from tools import Repository
File "/usr/lib/ckan/default/lib/python2.7/site-packages/vdm/sqlalchemy/tools.py", line 33, in
raise ValueError("VDM only works with SQLAlchemy versions 0.4 through 0.7, not: %s" % sqav)
ValueError: VDM only works with SQLAlchemy versions 0.4 through 0.7, not: 1.0.12
To reiterate the important bit, the error message says:
VDM only works with SQLAlchemy versions 0.4 through 0.7, not: 1.0.12
So it looks like you upgraded SQLAlchemy to the latest version somehow. This happens if you use the --upgrade flag when pip installing something, although the instructions you mention don't say to do that, so I'm not quite sure how you ended up with this version of SQLAlchemy.
I suggest you install the vdm and SQLAlchemy combination that is in the current ckan requirements which is currently:
pip install SQLAlchemy==0.9.6 vdm==0.13
and I believe this is backwards compatible with all ckan versions. (Remember to run pip with your virtualenv activated)
Fixed it using the following command to correct my version of sqlalchemy.
pip install -r /usr/lib/ckan/default/src/ckan/pip-requirements.txt.
This seemed to fix the error.
I'm trying to intall the asterisk_click2dial module on ODOO and this error comes to me in the log file:
ValueError: Routing: posting a message without model should be with a parent_id (private mesage).
2015-03-09 15:23:38,262 11093 ERROR ? werkzeug: Error on request:
Traceback (most recent call last):
File "/home/odoo/odoo/lib/python2.7/site-packages/werkzeug/serving.py", line 177, in run_wsgi
execute(self.server.app)
File "/home/odoo/odoo/lib/python2.7/site-packages/werkzeug/serving.py", line 165, in execute
application_iter = app(environ, start_response)
File "/opt/odoo/openerp/service/server.py", line 281, in app
return self.app(e, s)
File "/opt/odoo/openerp/service/wsgi_server.py", line 216, in application
return application_unproxied(environ, start_response)
File "/opt/odoo/openerp/service/wsgi_server.py", line 202, in application_unproxied
result = handler(environ, start_response)
File "/opt/odoo/openerp/http.py", line 1274, in __call__
self.load_addons()
File "/opt/odoo/openerp/http.py", line 1293, in load_addons
m = __import__('openerp.addons.' + module)
File "/opt/odoo/openerp/modules/module.py", line 79, in load_module
mod = imp.load_module('openerp.addons.' + module_part, f, path, descr)
File "/opt/odoo/addons/base_phone/__init__.py", line 23, in <module>
from . import wizard
File "/opt/odoo/addons/base_phone/wizard/__init__.py", line 23, in <module>
from . import number_not_found
File "/opt/odoo/addons/base_phone/wizard/number_not_found.py", line 25, in <module>
import phonenumbers
ImportError: No module named phonenumbers
The problem is just that I installed that module (phonenumbers) plus the py-Asterisk module without errors using pip install phonenumbers and pip install py-Asterisk and the error persists.
I noticed I have at least two versions of python installed (2.6 and 2.7) but both modules are installed at the same version from odoo (I can see the modules in the python2.7 cli when, for example, I write phonenumbers or search).
Has anybody any idea what is happening to me? I'd be gratefull for some specific response. Thanks.
Here the connector's page: OpenERP - Asterisk connector
Ok, my bad. During odoo instalation I created a virtual environment under the Odoo system user account which was used solely by the Odoo server so I just need to install these modules under that enviorment. This works for me:
First let’s switch from root to the odoo user, then create a new virtual environment called odoo and activate it:
su - odoo
/usr/local/bin/virtualenv --python=/usr/local/bin/python2.7 odoo
source odoo/bin/activate
(If you have the virtual environment created like me just ignore the second line). Before starting the module installation we need to add the path to the PostgreSQL binaries, otherwise the PsycoPG2 module install will fail (I ignored this one too):
export PATH=/usr/pgsql-9.3/bin:$PATH
Then I can do pip install... Thank you all for your help.
I tried to install django-chronograph to django-1.7 for assigning scheduled task in my django web-app.
I followed the instruction as shown here but it gives me the following error when running python manage.py makemigrations or python manage.py syncdb:
user#(none):~/mysite$ python manage.py makemigrations
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 354, in execute
django.setup()
File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 115, in populate
app_config.ready()
File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/apps.py", line 22, in ready
self.module.autodiscover()
File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/__init__.py", line 23, in autodiscover
autodiscover_modules('admin', register_to=site)
File "/usr/local/lib/python2.7/dist-packages/django/utils/module_loading.py", line 74, in autodiscover_modules
import_module('%s.%s' % (app_config.name, module_to_search))
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/usr/local/lib/python2.7/dist-packages/chronograph/admin.py", line 2, in <module>
from django.conf.urls.defaults import patterns, url
ImportError: No module named defaults
Is it django-chronograph not supported by django-1.7?
I've never heard of this package, but if you search for that error you will find that that import path hasn't worked since Django 1.6.
It could be that it's just the PyPI version that's old, and that the master branch works fine. However, the last commit to this package was in March 2013, and there's an open issue on the project's bitbucket page indicating that it fails to work on 1.6, so I doubt it.
In sum, it appears that this package supports neither Django 1.6 nor 1.7.
They already committed a fix, so to get rid of this error, don't go through:
pip install django-chronograph
I've just installed on Django 1.8 without issues (so far..) using:
pip install -e hg+https://bitbucket.org/wnielson/django-chronograph#f561106f6aaab62f2817e08e51c799320fd916d9#egg=django-chronograph