weak object has gone away? - python/django - python

I'm having this problem in my django project that I believe is related to caches. It appears once every 6 months or so and is "fixed" by restarting the app, only to come back some months later. Suddenly all views will fail with this exception.
TypeError: weak object has gone away
And it's not always the same object, every view fails with trying to access a different object. In this case it's accessing the user (with request.user.is_authenticated()) but other pages its with other objects.
I'm thinking there must be something wrong with the caches. Maybe its a problem in django even. I dont know. It just works fine until it doesnt and nobody seems to talk about this exception on the internet.
Here is a sample traceback:
Traceback (most recent call last):
File "/home/rsaenz/virtualenvs/club/lib/python2.7/site-packages/django/core/handlers/base.py", line 88, in get_response
response = middleware_method(request)
File "/home/rsaenz/webapps/club/club/cms/socios/views.py", line 143, in process_request
if not request.user.is_authenticated():
File "/home/rsaenz/virtualenvs/club/lib/python2.7/site-packages/django/utils/functional.py", line 213, in inner
self._setup()
File "/home/rsaenz/virtualenvs/club/lib/python2.7/site-packages/django/utils/functional.py", line 298, in _setup
self._wrapped = self._setupfunc()
File "/home/rsaenz/virtualenvs/club/lib/python2.7/site-packages/django/contrib/auth/middleware.py", line 18, in <lambda>
request.user = SimpleLazyObject(lambda: get_user(request))
File "/home/rsaenz/virtualenvs/club/lib/python2.7/site-packages/django/contrib/auth/middleware.py", line 10, in get_user
request._cached_user = auth.get_user(request)
File "/home/rsaenz/virtualenvs/club/lib/python2.7/site-packages/django/contrib/auth/__init__.py", line 140, in get_user
user_id = request.session[SESSION_KEY]
File "/home/rsaenz/virtualenvs/club/lib/python2.7/site-packages/django/contrib/sessions/backends/base.py", line 47, in __getitem__
return self._session[key]
File "/home/rsaenz/virtualenvs/club/lib/python2.7/site-packages/django/contrib/sessions/backends/base.py", line 173, in _get_session
self._session_cache = self.load()
File "/home/rsaenz/virtualenvs/club/lib/python2.7/site-packages/django/contrib/sessions/backends/db.py", line 20, in load
expire_date__gt=timezone.now()
File "/home/rsaenz/virtualenvs/club/lib/python2.7/site-packages/django/db/models/manager.py", line 151, in get
return self.get_queryset().get(*args, **kwargs)
File "/home/rsaenz/virtualenvs/club/lib/python2.7/site-packages/django/db/models/query.py", line 301, in get
clone = self.filter(*args, **kwargs)
File "/home/rsaenz/virtualenvs/club/lib/python2.7/site-packages/django/db/models/query.py", line 593, in filter
return self._filter_or_exclude(False, *args, **kwargs)
File "/home/rsaenz/virtualenvs/club/lib/python2.7/site-packages/django/db/models/query.py", line 611, in _filter_or_exclude
clone.query.add_q(Q(*args, **kwargs))
File "/home/rsaenz/virtualenvs/club/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1204, in add_q
clause = self._add_q(where_part, used_aliases)
File "/home/rsaenz/virtualenvs/club/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1240, in _add_q
current_negated=current_negated)
File "/home/rsaenz/virtualenvs/club/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1131, in build_filter
clause.add(constraint, AND)
File "/home/rsaenz/virtualenvs/club/lib/python2.7/site-packages/django/utils/tree.py", line 104, in add
data = self._prepare_data(data)
File "/home/rsaenz/virtualenvs/club/lib/python2.7/site-packages/django/db/models/sql/where.py", line 61, in _prepare_data
if is_iterator(value):
File "/home/rsaenz/virtualenvs/club/lib/python2.7/site-packages/django/utils/itercompat.py", line 30, in is_iterator
return isinstance(x, collections.Iterator)
File "/home/rsaenz/virtualenvs/club/lib/python2.7/abc.py", line 144, in __instancecheck__
return cls.__subclasscheck__(subtype)
File "/home/rsaenz/virtualenvs/club/lib/python2.7/abc.py", line 184, in __subclasscheck__
cls._abc_negative_cache.add(subclass)
File "/home/rsaenz/virtualenvs/club/lib/python2.7/_weakrefset.py", line 86, in add
self.data.add(ref(item, self._remove))
TypeError: weak object has gone away
thanks!

Based on the traceback this looks more like a Python weakrefset issue to me which collections.Iterator relies on through the abc (Abstract Base Class) module.

Related

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/

TypeError: verify_file() got an unexpected keyword argument 'data_filename' (GNUPG)

I am working with gnupg in a PythonAnywhere-Django environment to run Mayan EDMS. I recently changed from using python-gnupg to the standard gnupg as to finally overcome OSErrors. However, I have found out that some syntax needs to be changed due to this process (i.e., gnupghome>homedir; gpgbinary>binary, etc.). Has anyone ever encountered the correct replacement for data_filename in the verify_file command for gnupg? I have been browsing online for some time and have seen users only inputting two arguments, as opposed to the three I use now. The file name is vital to my code.
Traceback
2019-06-13 07:22:26,695: Unexpected exception while trying to create version for new document "testassayform.xlsx" from source "Default"; verify_file() got an unexpected keyword argument 'data_filename'
Traceback (most recent call last):
File "/home/mywebsite/.virtualenvs/env/lib/python3.7/site-packages/mayan/apps/sources/models/base.py", line 128, in upload_document
file_object=file_object, _user=user,
File "/home/mywebsite/.virtualenvs/env/lib/python3.7/site-packages/mayan/apps/documents/models/document_models.py", line 160, in new_version
document_version.save(_user=_user)
File "/home/mywebsite/.virtualenvs/env/lib/python3.7/site-packages/mayan/apps/documents/models/document_version_models.py", line 291, in save
document_version=self
File "/home/mywebsite/.virtualenvs/env/lib/python3.7/site-packages/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/mywebsite/.virtualenvs/env/lib/python3.7/site-packages/django/db/models/query.py", line 394, in create
obj.save(force_insert=True, using=self.db)
File "/home/mywebsite/.virtualenvs/env/lib/python3.7/site-packages/mayan/apps/document_signatures/models.py", line 111, in save
file_object=file_object
File "/home/mywebsite/.virtualenvs/env/lib/python3.7/site-packages/mayan/apps/django_gpg/managers.py", line 118, in verify_file
file_object=file_object, keys=keys
File "/home/mywebsite/.virtualenvs/env/lib/python3.7/site-packages/mayan/apps/django_gpg/classes.py", line 120, in verify_file
keys=keys, data_filename=data_filename
File "/home/mywebsite/.virtualenvs/env/lib/python3.7/site-packages/mayan/apps/django_gpg/classes.py", line 82, in gpg_command
result = function(gpg=gpg, **kwargs)
File "/home/mywebsite/.virtualenvs/env/lib/python3.7/site-packages/mayan/apps/django_gpg/classes.py", line 56, in _verify_file
file=file_object, data_filename=data_filename
TypeError: verify_file() got an unexpected keyword argument 'data_filename'
2019-06-13 07:22:26,781: Error executing document upload task; verify_file() got an unexpected keyword argument 'data_filename', <class 'TypeError'>
Traceback (most recent call last):
File "/home/mywebsite/.virtualenvs/env/lib/python3.7/site-packages/mayan/apps/sources/views.py", line 277, in forms_valid
user_id=user_id,
File "/home/mywebsite/.virtualenvs/env/lib/python3.7/site-packages/celery/app/task.py", line 565, in apply_async
link=link, link_error=link_error, **options)
File "/home/mywebsite/.virtualenvs/env/lib/python3.7/site-packages/celery/app/task.py", line 763, in apply
request=request, propagate=throw)
File "/home/mywebsite/.virtualenvs/env/lib/python3.7/site-packages/celery/app/trace.py", line 355, in eager_trace_task
uuid, args, kwargs, request)
File "/home/mywebsite/.virtualenvs/env/lib/python3.7/site-packages/celery/app/trace.py", line 253, in trace_task
I, R, state, retval = on_error(task_request, exc, uuid)
File "/home/mywebsite/.virtualenvs/env/lib/python3.7/site-packages/celery/app/trace.py", line 240, in trace_task
R = retval = fun(*args, **kwargs)
File "/home/mywebsite/.virtualenvs/env/lib/python3.7/site-packages/mayan/apps/sources/tasks.py", line 159, in task_source_handle_upload
shared_uploaded_file_id=shared_upload.pk, **kwargs
File "/home/mywebsite/.virtualenvs/env/lib/python3.7/site-packages/celery/app/task.py", line 461, in delay
return self.apply_async(args, kwargs)
File "/home/mywebsite/.virtualenvs/env/lib/python3.7/site-packages/celery/app/task.py", line 565, in apply_async
link=link, link_error=link_error, **options)
File "/home/mywebsite/.virtualenvs/env/lib/python3.7/site-packages/celery/app/task.py", line 763, in apply
request=request, propagate=throw)
File "/home/mywebsite/.virtualenvs/env/lib/python3.7/site-packages/celery/app/trace.py", line 355, in eager_trace_task
uuid, args, kwargs, request)
File "/home/mywebsite/.virtualenvs/env/lib/python3.7/site-packages/celery/app/trace.py", line 253, in trace_task
I, R, state, retval = on_error(task_request, exc, uuid)
File "/home/mywebsite/.virtualenvs/env/lib/python3.7/site-packages/celery/app/trace.py", line 240, in trace_task
R = retval = fun(*args, **kwargs)
File "/home/mywebsite/.virtualenvs/env/lib/python3.7/site-packages/mayan/apps/sources/tasks.py", line 193, in task_upload_document
querystring=querystring, user=user,
File "/home/mywebsite/.virtualenvs/env/lib/python3.7/site-packages/mayan/apps/sources/models/base.py", line 128, in upload_document
file_object=file_object, _user=user,
File "/home/mywebsite/.virtualenvs/env/lib/python3.7/site-packages/mayan/apps/documents/models/document_models.py", line 160, in new_version
document_version.save(_user=_user)
File "/home/mywebsite/.virtualenvs/env/lib/python3.7/site-packages/mayan/apps/documents/models/document_version_models.py", line 291, in save
document_version=self
File "/home/mywebsite/.virtualenvs/env/lib/python3.7/site-packages/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/mywebsite/.virtualenvs/env/lib/python3.7/site-packages/django/db/models/query.py", line 394, in create
obj.save(force_insert=True, using=self.db)
File "/home/mywebsite/.virtualenvs/env/lib/python3.7/site-packages/mayan/apps/document_signatures/models.py", line 111, in save
file_object=file_object
File "/home/mywebsite/.virtualenvs/env/lib/python3.7/site-packages/mayan/apps/django_gpg/managers.py", line 118, in verify_file
file_object=file_object, keys=keys
File "/home/mywebsite/.virtualenvs/env/lib/python3.7/site-packages/mayan/apps/django_gpg/classes.py", line 120, in verify_file
keys=keys, data_filename=data_filename
File "/home/mywebsite/.virtualenvs/env/lib/python3.7/site-packages/mayan/apps/django_gpg/classes.py", line 82, in gpg_command
result = function(gpg=gpg, **kwargs)
File "/home/mywebsite/.virtualenvs/env/lib/python3.7/site-packages/mayan/apps/django_gpg/classes.py", line 56, in _verify_file
file=file_object, data_filename=data_filename
TypeError: verify_file() got an unexpected keyword argument 'data_filename'
classes.py (relevant function)
def verify_file(self, file_object, keys, data_filename=None):
return self.gpg_command(
function=PythonGNUPGBackend._verify_file, file_object=file_object,
keys=keys, data_filename=data_filename
)
I simply removed the verify file function altogether to bypass this problem.
However, due to further restrictions in the conversion process, I do not recommend pursuing a similar workflow as Mayan EDMS requires LibreOffice, which requires a machine or specialized host which provides that.

Key Path Element Must be complete

I'm working through some documentation for the google cloud datastore API
from google.cloud import datastore
datastore_client = datastore.Client(project="PROJECTNAME")
query = datastore_client.query(kind='Video')
r = query.fetch()
for v in r:
key = datastore_client.key('VideosToCollections')
entity = datastore.Entity(key=key)
entity['collection_key'] = key
datastore_client.put(entity)
quit()
However I receive this error when updating an entry
Traceback (most recent call last):
File "fillvideocollections.py", line 20, in <module> datastore_client.put(entity)
File "/usr/local/lib/python2.7/dist-packages/google/cloud/datastore/client.py", line 421, in put
self.put_multi(entities=[entity])
File "/usr/local/lib/python2.7/dist-packages/google/cloud/datastore/client.py", line 448, in put_multi
current.commit()
File "/usr/local/lib/python2.7/dist-packages/google/cloud/datastore/batch.py", line 274, in commit
self._commit()
File "/usr/local/lib/python2.7/dist-packages/google/cloud/datastore/batch.py", line 250, in _commit
self.project, mode, self._mutations, transaction=self._id
File "/usr/local/lib/python2.7/dist-packages/google/cloud/datastore_v1/gapic/datastore_client.py", line 501, in commit
request, retry=retry, timeout=timeout, metadata=metadata
File "/usr/local/lib/python2.7/dist-packages/google/api_core/gapic_v1/method.py", line 143, in __call__
return wrapped_func(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/google/api_core/retry.py", line 270, in retry_wrapped_func
on_error=on_error,
File "/usr/local/lib/python2.7/dist-packages/google/api_core/retry.py", line 179, in retry_target
return target()
File "/usr/local/lib/python2.7/dist-packages/google/api_core/timeout.py", line 214, in func_with_timeout
return func(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/google/api_core/grpc_helpers.py", line 59, in error_remapped_callable
six.raise_from(exceptions.from_grpc_error(exc), exc)
File "/home/jeffbrubaker/.local/lib/python2.7/site-packages/six.py", line 737, in raise_from
raise value
google.api_core.exceptions.InvalidArgument: 400 Key path element must not be incomplete: [VideosToCollections: ]
I want the code above to create one VideosToCollections object as a stepping stone, but will expand to creating one per Video. Any thoughts on what is causing the above error would be appreciated.
I believe entity['collection_key'] = key is the culprit (key is datastore_client.key('VideosToCollections') which has no ID hence the path is incomplete). Perhaps you meant to set it to the key of v. So entity['collection_key'] = v.key

Test failures ("no transaction is active") with Ghost.py

I have a Django project that does some calculations in Javascript.
I am using Ghost.py to try and incorporate efficient tests of the Javascript calculations into the Django test suite:
from ghost.ext.django.test import GhostTestCase
class CalculationsTest(GhostTestCase):
def setUp(self):
page, resources = self.ghost.open('http://localhost:8081/_test/')
self.assertEqual(page.http_status, 200)
def test_frobnicate(self):
result, e_resources = self.ghost.evaluate('''
frobnicate(test_data, "argument");
''')
self.assertEqual(result, 1.204)
(where frobnicate() is a Javascript function on the test page.
This works very well if I run one test at a time.
If, however, I run django-admin.py test, I get
Traceback (most recent call last):
...
result = self.run_suite(suite)
File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/test/runner.py", line 113, in run_suite
).run(suite)
File "/usr/lib64/python2.7/unittest/runner.py", line 151, in run
test(result)
File "/usr/lib64/python2.7/unittest/suite.py", line 70, in __call__
return self.run(*args, **kwds)
File "/usr/lib64/python2.7/unittest/suite.py", line 108, in run
test(result)
File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/test/testcases.py", line 184, in __call__
super(SimpleTestCase, self).__call__(result)
File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/ghost/test.py", line 53, in __call__
self._post_teardown()
File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/test/testcases.py", line 796, in _post_teardown
self._fixture_teardown()
File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/test/testcases.py", line 817, in _fixture_teardown
inhibit_post_syncdb=self.available_apps is not None)
File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/core/management/__init__.py", line 159, in call_command
return klass.execute(*args, **defaults)
File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(*args, **options)
File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/core/management/base.py", line 415, in handle
return self.handle_noargs(**options)
File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/core/management/commands/flush.py", line 81, in handle_noargs
self.emit_post_syncdb(verbosity, interactive, db)
File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/core/management/commands/flush.py", line 101, in emit_post_syncdb
emit_post_sync_signal(set(all_models), verbosity, interactive, database)
File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/core/management/sql.py", line 216, in emit_post_sync_signal
interactive=interactive, db=db)
File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 185, in send
response = receiver(signal=self, sender=sender, **named)
File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py", line 82, in create_permissions
ctype = ContentType.objects.db_manager(db).get_for_model(klass)
File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/contrib/contenttypes/models.py", line 47, in get_for_model
defaults = {'name': smart_text(opts.verbose_name_raw)},
File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/db/models/manager.py", line 154, in get_or_create
return self.get_queryset().get_or_create(**kwargs)
File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/db/models/query.py", line 388, in get_or_create
six.reraise(*exc_info)
File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/db/models/query.py", line 380, in get_or_create
obj.save(force_insert=True, using=self.db)
File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/db/transaction.py", line 305, in __exit__
connection.commit()
File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/db/backends/__init__.py", line 168, in commit
self._commit()
File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/db/backends/__init__.py", line 136, in _commit
return self.connection.commit()
File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/db/utils.py", line 99, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/home/carl/.virtualenvs/fecfc/lib/python2.7/site-packages/django/db/backends/__init__.py", line 136, in _commit
return self.connection.commit()
django.db.utils.OperationalError: cannot commit - no transaction is active
(running with django-nose gives weirder, inconsistent results)
Any clues on how to prevent this issue, which is currently standing in the way of CI?
I haven't used Ghost myself but for a similar test I had to use TransactionTestCase to get a similar test working. Could you try changing GhostTestCase and see if that's working?

ArgumentError: An error occurred parsing (locally or remotely) the arguments to datastore_v3.Put()

My app started throwing this error last night. Users are complaining the site is slow as well. Still on Python 2.5. As far as I can tell the request itself is not unusual.
Any ideas?
Traceback (most recent call last):
File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/_webapp25.py", line 703, in __call__
handler.post(*groups)
File "/base/data/home/apps/s~jupitersfolly/4.357517623694016771/controller/frequest.py", line 57, in post
request_types[request_type]()
File "/base/data/home/apps/s~jupitersfolly/4.357517623694016771/controller/frequest.py", line 78, in order
event, report, messages = Game.update(game_number, user_id, order)
File "/base/data/home/apps/s~jupitersfolly/4.357517623694016771/model/game.py", line 355, in update
event, report, game, universe, messages, updated, ended = db.run_in_transaction(Game.transactional_update, key_id, user_id, order)
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py", line 2433, in RunInTransaction
return RunInTransactionOptions(None, function, *args, **kwargs)
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py", line 2571, in RunInTransactionOptions
ok, result = _DoOneTry(new_connection, function, args, kwargs)
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py", line 2593, in _DoOneTry
result = function(*args, **kwargs)
File "/base/data/home/apps/s~jupitersfolly/4.357517623694016771/model/game.py", line 348, in transactional_update
game.put()
File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/db/__init__.py", line 1074, in put
return datastore.Put(self._entity, **kwargs)
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py", line 579, in Put
return PutAsync(entities, **kwargs).get_result()
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 604, in get_result
return self.__get_result_hook(self)
File "/base/python_runtime/python_lib/versions/1/google/appengine/datastore/datastore_rpc.py", line 1577, in __put_hook
self.check_rpc_success(rpc)
File "/base/python_runtime/python_lib/versions/1/google/appengine/datastore/datastore_rpc.py", line 1212, in check_rpc_success
rpc.check_success()
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 570, in check_success
self.__rpc.CheckSuccess()
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/apiproxy_rpc.py", line 133, in CheckSuccess
raise self.exception
ArgumentError: An error occurred parsing (locally or remotely) the arguments to datastore_v3.Put()

Categories

Resources