SQLAlchemy pool.addListener Error - python

I'm creating a pylons app and I keep getting an error when trying to start the app with paster. I've searched for answers on google and keep coming up with nothing. Anyone have any ideas?
Traceback (most recent call last):
File "/opt/python2.7/bin/paster", line 8, in <module>
load_entry_point('PasteScript==1.7.3', 'console_scripts', 'paster')()
File "/opt/python2.7/lib/python2.7/site-packages/PasteScript-1.7.3-py2.7.egg/paste/script/command.py", line 84, in run
invoke(command, command_name, options, args[1:])
File "/opt/python2.7/lib/python2.7/site-packages/PasteScript-1.7.3-py2.7.egg/paste/script/command.py", line 123, in invoke
exit_code = runner.run(args)
File "/opt/python2.7/lib/python2.7/site-packages/PasteScript-1.7.3-py2.7.egg/paste/script/command.py", line 218, in run
result = self.command()
File "/opt/python2.7/lib/python2.7/site-packages/PasteScript-1.7.3-py2.7.egg/paste/script/serve.py", line 276, in command
relative_to=base, global_conf=vars)
File "/opt/python2.7/lib/python2.7/site-packages/PasteScript-1.7.3-py2.7.egg/paste/script/serve.py", line 313, in loadapp
**kw)
File "/opt/python2.7/lib/python2.7/site-packages/PasteDeploy-1.3.4-py2.7.egg/paste/deploy/loadwsgi.py", line 203, in loadapp
return loadobj(APP, uri, name=name, **kw)
File "/opt/python2.7/lib/python2.7/site-packages/PasteDeploy-1.3.4-py2.7.egg/paste/deploy/loadwsgi.py", line 224, in loadobj
return context.create()
File "/opt/python2.7/lib/python2.7/site-packages/PasteDeploy-1.3.4-py2.7.egg/paste/deploy/loadwsgi.py", line 617, in create
return self.object_type.invoke(self)
File "/opt/python2.7/lib/python2.7/site-packages/PasteDeploy-1.3.4-py2.7.egg/paste/deploy/loadwsgi.py", line 109, in invoke
return fix_call(context.object, context.global_conf, **context.local_conf)
File "/opt/python2.7/lib/python2.7/site-packages/PasteDeploy-1.3.4-py2.7.egg/paste/deploy/util/fixtypeerror.py", line 57, in fix_call
val = callable(*args, **kw)
File "/home/tripwire/foo.com/foo/foo/config/middleware.py", line 37, in make_app
config = load_environment(global_conf, app_conf)
File "/home/tripwire/foo.com/foo/foo/config/environment.py", line 49, in load_environment
engine = engine_from_config(config, 'sqlalchemy.')
File "/opt/python2.7/lib/python2.7/site-packages/SQLAlchemy-0.6.6-py2.7.egg/sqlalchemy/engine/__init__.py", line 281, in engine_from_config
return create_engine(url, **opts)
File "/opt/python2.7/lib/python2.7/site-packages/SQLAlchemy-0.6.6-py2.7.egg/sqlalchemy/engine/__init__.py", line 263, in create_engine
return strategy.create(*args, **kwargs)
File "/opt/python2.7/lib/python2.7/site-packages/SQLAlchemy-0.6.6-py2.7.egg/sqlalchemy/engine/strategies.py", line 152, in create
pool.add_listener({'first_connect':first_connect})
AttributeError: 'str' object has no attribute 'add_listener'

I figured it out, the book i was using said to use
sqlalchemy.pool = 3600
But apparently it's supposed to be
sqlalchemy.pool_recycle = 3600

Related

Error: Apps aren't loaded yet. when fork subprocess in django views

I want to fork subprocess in django view
def subprocess_setup():
if not settings.configured:
settings.configure()
django.setup()
class ABView(CustomModelViewSet):
def _query_facebook_balance(self, query_record_id):
...
#action(methods=['get'], url_path='account-balance', detail=True)
def query_account_balance(self, request, *args, **kwargs):
with ProcessPoolExecutor(max_workers=3, initializer=subprocess_setup) as pe:
process_list = []
future = pe.submit(VSSign()._query_facebook_balance, query_record_id)
process_list.append(future)
for future in as_completed(process_list):
future.result()
...
return Response(self.response_no_http_error(data=ret))
but it always failed like below.
Process SpawnProcess-1:
Traceback (most recent call last):
File "/usr/local/Cellar/python#3.9/3.9.13_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
self.run()
File "/usr/local/Cellar/python#3.9/3.9.13_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/Cellar/python#3.9/3.9.13_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/concurrent/futures/process.py", line 240, in _process_worker
call_item = call_queue.get(block=True)
File "/usr/local/Cellar/python#3.9/3.9.13_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/queues.py", line 122, in get
return _ForkingPickler.loads(res)
File "/Users/apple/Develop/bv_crm/api/sign/views.py", line 19, in <module>
from rest_framework.decorators import action
File "/Users/apple/Develop/bv_crm/venv3.9/lib/python3.9/site-packages/rest_framework/decorators.py", line 13, in <module>
from rest_framework.views import APIView
File "/Users/apple/Develop/bv_crm/venv3.9/lib/python3.9/site-packages/rest_framework/views.py", line 17, in <module>
from rest_framework.schemas import DefaultSchema
File "/Users/apple/Develop/bv_crm/venv3.9/lib/python3.9/site-packages/rest_framework/schemas/__init__.py", line 33, in <module>
authentication_classes=api_settings.DEFAULT_AUTHENTICATION_CLASSES,
File "/Users/apple/Develop/bv_crm/venv3.9/lib/python3.9/site-packages/rest_framework/settings.py", line 220, in __getattr__
val = perform_import(val, attr)
File "/Users/apple/Develop/bv_crm/venv3.9/lib/python3.9/site-packages/rest_framework/settings.py", line 168, in perform_import
return [import_from_string(item, setting_name) for item in val]
File "/Users/apple/Develop/bv_crm/venv3.9/lib/python3.9/site-packages/rest_framework/settings.py", line 168, in <listcomp>
return [import_from_string(item, setting_name) for item in val]
File "/Users/apple/Develop/bv_crm/venv3.9/lib/python3.9/site-packages/rest_framework/settings.py", line 177, in import_from_string
return import_string(val)
File "/Users/apple/Develop/bv_crm/venv3.9/lib/python3.9/site-packages/django/utils/module_loading.py", line 17, in import_string
module = import_module(module_path)
File "/usr/local/Cellar/python#3.9/3.9.13_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/Users/apple/Develop/bv_crm/utils/middleware.py", line 10, in <module>
from django.contrib.sessions.models import Session
File "/Users/apple/Develop/bv_crm/venv3.9/lib/python3.9/site-packages/django/contrib/sessions/models.py", line 1, in <module>
from django.contrib.sessions.base_session import (
File "/Users/apple/Develop/bv_crm/venv3.9/lib/python3.9/site-packages/django/contrib/sessions/base_session.py", line 26, in <module>
class AbstractBaseSession(models.Model):
File "/Users/apple/Develop/bv_crm/venv3.9/lib/python3.9/site-packages/django/db/models/base.py", line 103, in __new__
app_config = apps.get_containing_app_config(module)
File "/Users/apple/Develop/bv_crm/venv3.9/lib/python3.9/site-packages/django/apps/registry.py", line 252, in get_containing_app_config
self.check_apps_ready()
File "/Users/apple/Develop/bv_crm/venv3.9/lib/python3.9/site-packages/django/apps/registry.py", line 135, in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
Internal Server Error: /api/sign-account-balance/12434
Traceback (most recent call last):
File "/Users/apple/Develop/bv_crm/venv3.9/lib/python3.9/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/Users/apple/Develop/bv_crm/venv3.9/lib/python3.9/site-packages/django/core/handlers/base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/Users/apple/Develop/bv_crm/venv3.9/lib/python3.9/site-packages/django/core/handlers/base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/apple/Develop/bv_crm/venv3.9/lib/python3.9/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "/Users/apple/Develop/bv_crm/venv3.9/lib/python3.9/site-packages/rest_framework/viewsets.py", line 114, in view
return self.dispatch(request, *args, **kwargs)
File "/Users/apple/Develop/bv_crm/utils/views.py", line 165, in dispatch
return super(CustomModelViewSet, self).dispatch(request, *args, **kwargs)
File "/Users/apple/Develop/bv_crm/venv3.9/lib/python3.9/site-packages/rest_framework/views.py", line 505, in dispatch
response = self.handle_exception(exc)
File "/Users/apple/Develop/bv_crm/venv3.9/lib/python3.9/site-packages/rest_framework/views.py", line 465, in handle_exception
self.raise_uncaught_exception(exc)
File "/Users/apple/Develop/bv_crm/venv3.9/lib/python3.9/site-packages/rest_framework/views.py", line 476, in raise_uncaught_exception
raise exc
File "/Users/apple/Develop/bv_crm/venv3.9/lib/python3.9/site-packages/rest_framework/views.py", line 502, in dispatch
response = handler(request, *args, **kwargs)
File "/Users/apple/Develop/bv_crm/api/sign/views.py", line 314, in query_account_balance
future.result()
File "/usr/local/Cellar/python#3.9/3.9.13_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/concurrent/futures/_base.py", line 439, in result
return self.__get_result()
File "/usr/local/Cellar/python#3.9/3.9.13_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/concurrent/futures/_base.py", line 391, in __get_result
raise self._exception
concurrent.futures.process.BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending.
I'm working with Django==2.2.4 + python3.9 + mac os 10.15.5
Can anyone tell me the reason, great thanks!

"KeyError: 0" when connecting to MySQL (get_default_isolation_level)

Currently developing for python 3.9.6 with sqlalchemy version 1.4.23 and whenever I use sqlalchemy to connect to a database, I get an error with this stack trace:
Traceback (most recent call last):
File "/mnt/c/Importer/common/db.py", line 106, in db_cur
with engine.connect() as con:
File "/home/jimmy/.local/share/virtualenvs/Importer-0-6a4YAh/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 3166, in connect
return self._connection_cls(self, close_with_result=close_with_result)
File "/home/jimmy/.local/share/virtualenvs/Importer-0-6a4YAh/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 96, in __init__
else engine.raw_connection()
File "/home/jimmy/.local/share/virtualenvs/Importer-0-6a4YAh/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 3245, in raw_connection
return self._wrap_pool_connect(self.pool.connect, _connection)
File "/home/jimmy/.local/share/virtualenvs/Importer-0-6a4YAh/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 3212, in _wrap_pool_connect
return fn()
File "/home/jimmy/.local/share/virtualenvs/Importer-0-6a4YAh/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 307, in connect
return _ConnectionFairy._checkout(self)
File "/home/jimmy/.local/share/virtualenvs/Importer-0-6a4YAh/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 767, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File "/home/jimmy/.local/share/virtualenvs/Importer-0-6a4YAh/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 425, in checkout
rec = pool._do_get()
File "/home/jimmy/.local/share/virtualenvs/Importer-0-6a4YAh/lib/python3.9/site-packages/sqlalchemy/pool/impl.py", line 146, in _do_get
self._dec_overflow()
File "/home/jimmy/.local/share/virtualenvs/Importer-0-6a4YAh/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 70, in __exit__
compat.raise_(
File "/home/jimmy/.local/share/virtualenvs/Importer-0-6a4YAh/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 207, in raise_
raise exception
File "/home/jimmy/.local/share/virtualenvs/Importer-0-6a4YAh/lib/python3.9/site-packages/sqlalchemy/pool/impl.py", line 143, in _do_get
return self._create_connection()
File "/home/jimmy/.local/share/virtualenvs/Importer-0-6a4YAh/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 253, in _create_connection
return _ConnectionRecord(self)
File "/home/jimmy/.local/share/virtualenvs/Importer-0-6a4YAh/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 368, in __init__
self.__connect()
File "/home/jimmy/.local/share/virtualenvs/Importer-0-6a4YAh/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 622, in __connect
pool.dispatch.connect.for_modify(
File "/home/jimmy/.local/share/virtualenvs/Importer-0-6a4YAh/lib/python3.9/site-packages/sqlalchemy/event/attr.py", line 329, in _exec_w_sync_on_first_run
self(*args, **kw)
File "/home/jimmy/.local/share/virtualenvs/Importer-0-6a4YAh/lib/python3.9/site-packages/sqlalchemy/event/attr.py", line 343, in __call__
fn(*args, **kw)
File "/home/jimmy/.local/share/virtualenvs/Importer-0-6a4YAh/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 1691, in go
return once_fn(*arg, **kw)
File "/home/jimmy/.local/share/virtualenvs/Importer-0-6a4YAh/lib/python3.9/site-packages/sqlalchemy/engine/create.py", line 674, in first_connect
dialect.initialize(c)
File "/home/jimmy/.local/share/virtualenvs/Importer-0-6a4YAh/lib/python3.9/site-packages/sqlalchemy/dialects/mysql/base.py", line 2961, in initialize
default.DefaultDialect.initialize(self, connection)
File "/home/jimmy/.local/share/virtualenvs/Importer-0-6a4YAh/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 407, in initialize
self.default_isolation_level = self.get_default_isolation_level(
File "/home/jimmy/.local/share/virtualenvs/Importer-0-6a4YAh/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 473, in get_default_isolation_level
return self.get_isolation_level(dbapi_conn)
File "/home/jimmy/.local/share/virtualenvs/Importer-0-6a4YAh/lib/python3.9/site-packages/sqlalchemy/dialects/mysql/base.py", line 2720, in get_isolation_level
val = row[0]
KeyError: 0
I can fix the issue by manually changing the file from
val = row[0]
to
val = row['##transaction_isolation']
but I don't want to have to manually change dependency files after installing them. I have tried manually setting the transaction isolation when creating the engine, but that doesn't prevent get_isolation_level() from being called so the error persists. Is sqlalchemy not compatible with python 3.9.6? Does this have anything to do with the mysql server version?
Problem was with the DictCursor being used in the connection. Changing _fetch_type for SELECT ##transaction_isolation to be a tuple instead of a dictionary solved the issue.

Why do I get the error "Name node can't be used with 'None' constant" when I try to run Odoo?

I am trying to setup odoo on my mac by following the instructions linked on the github page. When starting the server using this command:
python3 odoo-bin --addons-path=addons -d mydb -i base
The server starts and I see one database "mydb" on the odoo splash page. Then when I click that database I get the following error:
ERROR mydb werkzeug: Error on request:
Traceback (most recent call last):
File "/Users/[username]/Documents/GitHub/odoo/venv/lib/python3.8/site-packages/werkzeug/serving.py", line 270, in run_wsgi
execute(self.server.app)
File "/Users/[username]/Documents/GitHub/odoo/venv/lib/python3.8/site-packages/werkzeug/serving.py", line 258, in execute
application_iter = app(environ, start_response)
File "/Users/[username]/Documents/GitHub/odoo/odoo/service/server.py", line 439, in app
return self.app(e, s)
File "/Users/[username]/Documents/GitHub/odoo/odoo/service/wsgi_server.py", line 142, in application
return application_unproxied(environ, start_response)
File "/Users/[username]/Documents/GitHub/odoo/odoo/service/wsgi_server.py", line 117, in application_unproxied
result = odoo.http.root(environ, start_response)
File "/Users/[username]/Documents/GitHub/odoo/odoo/http.py", line 1287, in __call__
return self.dispatch(environ, start_response)
File "/Users/[username]/Documents/GitHub/odoo/odoo/http.py", line 1257, in __call__
return self.app(environ, start_wrapped)
File "/Users/[username]/Documents/GitHub/odoo/venv/lib/python3.8/site-packages/werkzeug/wsgi.py", line 766, in __call__
return self.app(environ, start_response)
File "/Users/[username]/Documents/GitHub/odoo/odoo/http.py", line 1457, in dispatch
result = ir_http._dispatch()
File "/Users/[username]/Documents/GitHub/odoo/addons/web_editor/models/ir_http.py", line 21, in _dispatch
return super(IrHttp, cls)._dispatch()
File "/Users/[username]/Documents/GitHub/odoo/odoo/addons/base/models/ir_http.py", line 238, in _dispatch
return cls._handle_exception(e)
File "/Users/[username]/Documents/GitHub/odoo/odoo/addons/base/models/ir_http.py", line 206, in _handle_exception
return request._handle_exception(exception)
File "/Users/[username]/Documents/GitHub/odoo/odoo/http.py", line 750, in _handle_exception
return super(HttpRequest, self)._handle_exception(exception)
File "/Users/[username]/Documents/GitHub/odoo/odoo/http.py", line 310, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/Users/[username]/Documents/GitHub/odoo/odoo/tools/pycompat.py", line 14, in reraise
raise value
File "/Users/[username]/Documents/GitHub/odoo/odoo/addons/base/models/ir_http.py", line 234, in _dispatch
result = request.dispatch()
File "/Users/[username]/Documents/GitHub/odoo/odoo/http.py", line 809, in dispatch
r = self._call_function(**self.params)
File "/Users/[username]/Documents/GitHub/odoo/odoo/http.py", line 350, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/Users/[username]/Documents/GitHub/odoo/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/Users/[username]/Documents/GitHub/odoo/odoo/http.py", line 342, in checked_call
result.flatten()
File "/Users/[username]/Documents/GitHub/odoo/odoo/http.py", line 1236, in flatten
self.response.append(self.render())
File "/Users/[username]/Documents/GitHub/odoo/odoo/http.py", line 1229, in render
return env["ir.ui.view"].render_template(self.template, self.qcontext)
File "/Users/[username]/Documents/GitHub/odoo/odoo/addons/base/models/ir_ui_view.py", line 1177, in render_template
return self.browse(self.get_view_id(template)).render(values, engine)
File "/Users/[username]/Documents/GitHub/odoo/addons/web_editor/models/ir_ui_view.py", line 27, in render
return super(IrUiView, self).render(values=values, engine=engine, minimal_qcontext=minimal_qcontext)
File "/Users/[username]/Documents/GitHub/odoo/odoo/addons/base/models/ir_ui_view.py", line 1185, in render
return self.env[engine].render(self.id, qcontext)
File "/Users/[username]/Documents/GitHub/odoo/odoo/addons/base/models/ir_qweb.py", line 58, in render
result = super(IrQWeb, self).render(id_or_xml_id, values=values, **context)
File "/Users/[username]/Documents/GitHub/odoo/odoo/addons/base/models/qweb.py", line 260, in render
self.compile(template, options)(self, body.append, values or {})
File "<decorator-gen-53>", line 2, in compile
File "/Users/[username]/Documents/GitHub/odoo/odoo/tools/cache.py", line 90, in lookup
value = d[key] = self.method(*args, **kwargs)
File "/Users/[username]/Documents/GitHub/odoo/odoo/addons/base/models/ir_qweb.py", line 113, in compile
return super(IrQWeb, self).compile(id_or_xml_id, options=options)
File "/Users/[username]/Documents/GitHub/odoo/odoo/addons/base/models/qweb.py", line 323, in compile
raise QWebException("Error when compiling AST", e, path, node and etree.tostring(node[0], encoding='unicode'), name)
odoo.addons.base.models.qweb.QWebException: Name node can't be used with 'None' constant
Traceback (most recent call last):
File "/Users/[username]/Documents/GitHub/odoo/odoo/tools/cache.py", line 85, in lookup
r = d[key]
File "/Users/[username]/Documents/GitHub/odoo/odoo/tools/func.py", line 69, in wrapper
return func(self, *args, **kwargs)
File "/Users/[username]/Documents/GitHub/odoo/odoo/tools/lru.py", line 44, in __getitem__
a = self.d[obj].me
KeyError: ('ir.qweb', <function IrQWeb.compile at 0x7f9436306310>, 196, ('en_US', None, None, None, None, None))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/[username]/Documents/GitHub/odoo/odoo/addons/base/models/qweb.py", line 315, in compile
unsafe_eval(compile(astmod, '<template>', 'exec'), ns)
ValueError: Name node can't be used with 'None' constant
Error when compiling AST
ValueError: Name node can't be used with 'None' constant
Template: web.login
Path: /t/t/form/input[2]
Node: <input type="hidden" name="redirect" t-att-value="redirect"/> - - -
I don't know where to start with this error. I have looked up the web.login template and didnt find anything.
This is a bug in Odoo. It was probably silent before but it is now causing a crash since a recent version of Python 3.8. You could downgrade to an earlier version (like python-3.8.3) temporarily until Odoo is fixed.
More here
The solution to this issue is to downgrade the version of python you are running on. If suppose you are running on python3.8, you should downgrade to python 3.6 as explained by Husain Rangwala in this article https://www.odoo.com/forum/help-1/valueerror-name-node-can-t-be-used-with-none-constant-template-1105-path-templates-t-t-div-t-t-after-updating-to-python-3-8-5-177836. To switch between python versions, visit https://hackersandslackers.com/multiple-versions-python-ubuntu/

Unhandled exception in thread started

When i run project i get this error in module init.py of Mysqldb at line from MySQLdb.connections import Connection.
What is the meaning of this error, and how do I fix it?. Python 3.4 (64x), Django, Connector and Mysqldb are installed.
def Connect(*args, **kwargs):
from MySQLdb.connections import Connection
return Connection(*args, **kwargs)
Console log:
Unhandled exception in thread started by <pydev_monkey._NewThreadStartupWithTrace object at 0x0000000004D682B0>
Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm 4.5.4\helpers\pydev\pydev_monkey.py", line 427, in __call__
return self.original_func(*self.args, **self.kwargs)
File "C:\Python34\lib\site-packages\django\utils\autoreload.py", line 229, in wrapper
fn(*args, **kwargs)
File "C:\Python34\lib\site-packages\django\core\management\commands\runserver.py", line 114, in inner_run
self.validate(display_num_errors=True)
File "C:\Python34\lib\site-packages\django\core\management\base.py", line 469, in validate
return self.check(app_configs=app_configs, display_num_errors=display_num_errors)
File "C:\Python34\lib\site-packages\django\core\management\base.py", line 482, in check
include_deployment_checks=include_deployment_checks,
File "C:\Python34\lib\site-packages\django\core\checks\registry.py", line 72, in run_checks
new_errors = check(app_configs=app_configs)
File "C:\Python34\lib\site-packages\django\core\checks\model_checks.py", line 28, in check_all_models
errors.extend(model.check(**kwargs))
File "C:\Python34\lib\site-packages\django\db\models\base.py", line 1205, in check
errors.extend(cls._check_fields(**kwargs))
File "C:\Python34\lib\site-packages\django\db\models\base.py", line 1282, in _check_fields
errors.extend(field.check(**kwargs))
File "C:\Python34\lib\site-packages\django\db\models\fields\__init__.py", line 934, in check
errors = super(AutoField, self).check(**kwargs)
File "C:\Python34\lib\site-packages\django\db\models\fields\__init__.py", line 207, in check
errors.extend(self._check_backend_specific_checks(**kwargs))
File "C:\Python34\lib\site-packages\django\db\models\fields\__init__.py", line 306, in _check_backend_specific_checks
return connection.validation.check_field(self, **kwargs)
File "C:\Python34\lib\site-packages\django\db\backends\mysql\validation.py", line 18, in check_field
field_type = field.db_type(connection)
File "C:\Python34\lib\site-packages\django\db\models\fields\__init__.py", line 614, in db_type
return connection.data_types[self.get_internal_type()] % data
File "C:\Python34\lib\site-packages\django\db\__init__.py", line 36, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "C:\Python34\lib\site-packages\django\utils\functional.py", line 59, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Python34\lib\site-packages\django\db\backends\mysql\base.py", line 196, in data_types
if self.features.supports_microsecond_precision:
File "C:\Python34\lib\site-packages\django\utils\functional.py", line 59, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Python34\lib\site-packages\django\db\backends\mysql\features.py", line 52, in supports_microsecond_precision
return self.connection.mysql_version >= (5, 6, 4) and Database.version_info >= (1, 2, 5)
File "C:\Python34\lib\site-packages\django\utils\functional.py", line 59, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Python34\lib\site-packages\django\db\backends\mysql\base.py", line 371, in mysql_version
with self.temporary_connection():
File "C:\Python34\lib\contextlib.py", line 59, in __enter__
return next(self.gen)
File "C:\Python34\lib\site-packages\django\db\backends\base\base.py", line 462, in temporary_connection
cursor = self.cursor()
File "C:\Python34\lib\site-packages\django\db\backends\base\base.py", line 162, in cursor
cursor = self.make_debug_cursor(self._cursor())
File "C:\Python34\lib\site-packages\django\db\backends\base\base.py", line 135, in _cursor
self.ensure_connection()
File "C:\Python34\lib\site-packages\django\db\backends\base\base.py", line 130, in ensure_connection
self.connect()
File "C:\Python34\lib\site-packages\django\db\backends\base\base.py", line 119, in connect
self.connection = self.get_new_connection(conn_params)
File "C:\Python34\lib\site-packages\django\db\backends\mysql\base.py", line 276, in get_new_connection
conn = Database.connect(**conn_params)
File "C:\Python34\lib\site-packages\MySQLdb\__init__.py", line 80, in Connect
from MySQLdb.connections import Connection
File "C:\Python34\lib\site-packages\MySQLdb\connections.py", line 36
raise errorclass, errorvalue
^
SyntaxError: invalid syntax
MySQLdb does not support Python 3.
There are other clients available though.
You can use mysqlclient. Which is a fork of MySQLdb.
The MySQLdb package you are using is not Python 3. It is a Python 2 package. In Python 2 you can raise an error as you see at the bottom of this stack trace. In Python 3 it should be:
raise errorclass(errorvalue)

CKAN won't start

On my FreeBSD 10, I managed to install PostgreSQL, Apache Solr and CKAN but when I run paster serve /etc/ckan/default/development.ini I get these error messages (I know there is an issue with CKAN because on my ip:5000 I have a error: connection failed).
Here are the error messages:
$ paster serve /etc/ckan/default/production.ini
Traceback (most recent call last):
File "/usr/lib/ckan/default/bin/paster", line 9, in <module>
load_entry_point('PasteScript==1.7.5', 'console_scripts', 'paster')()
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/command.py", line 104, in run
invoke(command, command_name, options, args[1:])
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/command.py", line 143, in invoke
exit_code = runner.run(args)
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/command.py", line 238, in run
result = self.command()
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/serve.py", line 284, in command
relative_to=base, global_conf=vars)
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/serve.py", line 321, in loadapp
**kw)
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 272, in loadobj
return context.create()
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 710, in create
return self.object_type.invoke(self)
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 146, in invoke
return fix_call(context.object, context.global_conf, **context.local_conf)
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/deploy/util.py", line 56, in fix_call
val = callable(*args, **kw)
File "/root/ckan/lib/default/src/ckan/ckan/config/middleware.py", line 58, in make_app
load_environment(conf, app_conf)
File "/root/ckan/lib/default/src/ckan/ckan/config/environment.py", line 232, in load_environment
p.load_all(config)
File "/root/ckan/lib/default/src/ckan/ckan/plugins/core.py", line 134, in load_all
load(*plugins)
File "/root/ckan/lib/default/src/ckan/ckan/plugins/core.py", line 170, in load
plugins_update()
File "/root/ckan/lib/default/src/ckan/ckan/plugins/core.py", line 116, in plugins_update
environment.update_config()
File "/root/ckan/lib/default/src/ckan/ckan/config/environment.py", line 357, in update_config
plugin.configure(config)
File "/root/ckan/lib/default/src/ckan/ckanext/datastore/plugin.py", line 115, in configure
self._check_urls_and_permissions()
File "/root/ckan/lib/default/src/ckan/ckanext/datastore/plugin.py", line 159, in _check_urls_and_permissions
self._log_or_raise('The read-only user has write privileges.')
File "/root/ckan/lib/default/src/ckan/ckanext/datastore/plugin.py", line 140, in _log_or_raise
raise DatastoreException(message)
ckanext.datastore.plugin.DatastoreException: The read-only user has write privileges.
What should I do?
Your read-only postgresql user for the datastore database is not setup correctly: the user has write privileges. The relevant part of the docs is: http://docs.ckan.org/en/latest/maintaining/datastore.html#set-permissions
I too faced the problem like this....I have deleted the user "datastore_default" from the postgres. For Deleting the Postgres User Please refer: Postgres Delete user
And create again the postgres user "datastore_default" as per the CKAN Documentation. Please ref: Create User datastore_default for CKAN

Categories

Resources