I get the error when I updated from django 1.8 to 1.11.13 relation "social_auth_usersocialauth" does not exist [closed] - python-social-auth

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
I have updated my django from 1.8 to 1.11.13 recently. My application was running perfectly with django 1.8. But when I updated it is throwing this error:
django.db.utils.ProgrammingError: relation "social_auth_usersocialauth" does not exist
I am using the following versions
python-social-auth==0.3.6
social-auth-app-django==2.1.0
social-auth-core==1.7.0
And here is the stacktrace
ERROR Internal Server Error: /account/settings/
Traceback (most recent call last):
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
psycopg2.ProgrammingError: relation "social_auth_usersocialauth" does not exist
LINE 1: ...", "social_auth_usersocialauth"."extra_data" FROM "social_au...
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/core/handlers/base.py", line 249, in _legacy_get_response
response = self._get_response(request)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/core/handlers/base.py", line 217, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/core/handlers/base.py", line 215, in _get_response
response = response.render()
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/response.py", line 107, in render
self.content = self.rendered_content
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/response.py", line 84, in rendered_content
content = template.render(context, self._request)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/backends/django.py", line 66, in render
return self.template.render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/base.py", line 207, in render
return self._render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/test/utils.py", line 107, in instrumented_test_render
return self.nodelist.render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/base.py", line 990, in render
bit = node.render_annotated(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/base.py", line 957, in render_annotated
return self.render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/loader_tags.py", line 177, in render
return compiled_parent._render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/test/utils.py", line 107, in instrumented_test_render
return self.nodelist.render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/base.py", line 990, in render
bit = node.render_annotated(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/base.py", line 957, in render_annotated
return self.render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/loader_tags.py", line 177, in render
return compiled_parent._render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/test/utils.py", line 107, in instrumented_test_render
return self.nodelist.render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/base.py", line 990, in render
bit = node.render_annotated(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/base.py", line 957, in render_annotated
return self.render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/defaulttags.py", line 411, in render
return strip_spaces_between_tags(self.nodelist.render(context).strip())
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/base.py", line 990, in render
bit = node.render_annotated(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/base.py", line 957, in render_annotated
return self.render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/loader_tags.py", line 72, in render
result = block.nodelist.render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/base.py", line 990, in render
bit = node.render_annotated(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/base.py", line 957, in render_annotated
return self.render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/loader_tags.py", line 72, in render
result = block.nodelist.render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/base.py", line 990, in render
bit = node.render_annotated(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/base.py", line 957, in render_annotated
return self.render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/loader_tags.py", line 72, in render
result = block.nodelist.render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/base.py", line 990, in render
bit = node.render_annotated(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/base.py", line 957, in render_annotated
return self.render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/defaulttags.py", line 529, in render
return self.nodelist.render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/base.py", line 990, in render
bit = node.render_annotated(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/base.py", line 957, in render_annotated
return self.render(context)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/template/defaulttags.py", line 321, in render
if match:
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/db/models/query.py", line 254, in __bool__
self._fetch_all()
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/db/models/query.py", line 1118, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/db/models/query.py", line 53, in __iter__
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/db/models/sql/compiler.py", line 899, in execute_sql
raise original_exception
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/db/models/sql/compiler.py", line 889, in execute_sql
cursor.execute(sql, params)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/db/backends/utils.py", line 79, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/db/utils.py", line 94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/Users/sajidur/Coding/socialfunders/sf/venv3/lib/python3.5/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "social_auth_usersocialauth" does not exist
LINE 1: ...", "social_auth_usersocialauth"."extra_data" FROM "social_au...

I figured out, after inspecting the database tables, that none of the tables from social-auth were created. This led me conclude that django did not find the app from the list of INSATALLED_APPS. I went through the documentation and found out that I have to add social_django to the list of installed apps. Previously, I did not have to add that. So this solved my problem.

Related

How can I solve Odoo Server Error while Importing .zip Studio File

I am trying to import .zip Studio Customization file to Odoo Version 15. As we are migrating our Odoo System we want transfer our Studio Customizations from the development Database to the Production Database.I am getting the following Error:
1.
Traceback (most recent call last):
File "/home/secusmart/odoo15-prod/odoo/odoo/tools/cache.py", line 85, in lookup
r = d[key]
File "/home/secusmart/odoo15-prod/odoo/odoo/tools/func.py", line 71, in wrapper
return func(self, *args, **kwargs)
File "/home/secusmart/odoo15-prod/odoo/odoo/tools/lru.py", line 34, in __getitem__
a = self.d[obj]
KeyError: ('ir.model.access', <function IrModelAccess.check at 0x7f330bb4f4c0>, 2, False, 'base.import.module', 'write', True, ('en_US',))
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/secusmart/odoo15-prod/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/home/secusmart/odoo15-prod/odoo/odoo/http.py", line 688, in dispatch
result = self._call_function(**self.params)
File "/home/secusmart/odoo15-prod/odoo/odoo/http.py", line 360, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/secusmart/odoo15-prod/odoo/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/home/secusmart/odoo15-prod/odoo/odoo/http.py", line 349, in checked_call
result = self.endpoint(*a, **kw)
File "/home/secusmart/odoo15-prod/odoo/odoo/http.py", line 917, in __call__
return self.method(*args, **kw)
File "/home/secusmart/odoo15-prod/odoo/odoo/http.py", line 536, in response_wrap
response = f(*args, **kw)
File "/home/secusmart/odoo15-prod/odoo/addons/web/controllers/main.py", line 1352, in call_button
action = self._call_kw(model, method, args, kwargs)
File "/home/secusmart/odoo15-prod/odoo/addons/web/controllers/main.py", line 1340, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/home/secusmart/odoo15-prod/odoo/odoo/api.py", line 464, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/home/secusmart/odoo15-prod/odoo/odoo/api.py", line 451, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "/home/secusmart/odoo15-prod/odoo/addons/base_import_module/models/base_import_module.py", line 24, in import_module
self.write({'state': 'done', 'import_message': res[0]})
File "/home/secusmart/odoo15-prod/odoo/odoo/models.py", line 3763, in write
self.check_access_rights('write')
File "/home/secusmart/odoo15-prod/odoo/odoo/models.py", line 3538, in check_access_rights
return self.env['ir.model.access'].check(self._name, operation, raise_exception)
File "<decorator-gen-33>", line 2, in check
File "/home/secusmart/odoo15-prod/odoo/odoo/tools/cache.py", line 90, in lookup
value = d[key] = self.method(*args, **kwargs)
File "/home/secusmart/odoo15-prod/odoo/odoo/addons/base/models/ir_model.py", line 1762, in check
self._cr.execute("""SELECT MAX(CASE WHEN perm_{mode} THEN 1 ELSE 0 END)
File "<decorator-gen-3>", line 2, in execute
File "/home/secusmart/odoo15-prod/odoo/odoo/sql_db.py", line 89, in check
return f(self, *args, **kwargs)
File "/home/secusmart/odoo15-prod/odoo/odoo/sql_db.py", line 310, in execute
res = self._obj.execute(query, params)
Exception
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/secusmart/odoo15-prod/odoo/odoo/http.py", line 644, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/secusmart/odoo15-prod/odoo/odoo/http.py", line 302, in _handle_exception
raise exception.with_traceback(None) from new_cause
psycopg2.errors.InFailedSqlTransaction: current transaction is aborted, commands ignored until end of transaction block
I fixed the first error by performing the import as superuser
Now I got the following Error:
2.
Traceback (most recent call last):
File "/home/secusmart/odoo15-prod/odoo/odoo/tools/cache.py", line 85, in lookup
r = d[key]
File "/home/secusmart/odoo15-prod/odoo/odoo/tools/func.py", line 71, in wrapper
return func(self, *args, **kwargs)
File "/home/secusmart/odoo15-prod/odoo/odoo/tools/lru.py", line 34, in __getitem__
a = self.d[obj]
KeyError: ('res.lang', <function Lang.get_installed at 0x7f330ab8b4c0>)
You can refer to this answer: Is it possible to import Odoo15 Studio .zip file to Odoo16?
As a small recap, basically you should use the migration tools offered by odoo. You have an enterprise subscription and are using a version of Odoo that is still supported. So migrating your database by Odoo employees should already be possible - and free.

OSM data at a specific time

I want to read data from my OSM file at a specific time.
import osmium
import pandas
class TimelineHandler(osmium.SimpleHandler):
def __init__(self):
osmium.SimpleHandler.__init__(self)
self.elemtimeline = []
def relation(self, n):
self.elemtimeline.append(["relation",
n.id,
n.version,
n.visible,
pandas.Timestamp(n.timestamp),
n.uid,
n.changeset,
len(n.tags)])
tlhandler = TimelineHandler()
tlhandler.apply_file('/.../.../.../koeln-regbez-internal.osh.pbf')
colnames = ['type', 'id', 'version', 'visible', 'ts', 'uid', 'chgset', 'ntags']
elements = pandas.DataFrame(tlhandler.elemtimeline, columns=colnames)
elements = elements.sort_values(by=['type', 'id', 'ts'])
elements.head()
print(elements.head())
elements.to_csv("Köln-metropole.csv", date_format='%Y-%m-%d %H:%M:%S')
def updatedelem(data):
updata = data.groupby(['type', 'id'])['version'].max().reset_index()
return pandas.merge(updata, data, on=['id', 'version'])
uptodate_elem = updatedelem(elements)
uptodate_elem.head()
print(uptodate_elem.head())
elements.to_csv("Köln-metropole.csv", date_format='%Y-%m-%d %H:%M:%S')
**The code works until I enter the following function. Here is the problem. There are a lot of error messages displayed. Probably it is because something is wrong with "Date".
Warnings: Parameter 'date' value is not used AND Shadows name 'datedelems' from outer scope**
def datedelems(history, date):
datedelems = (history.query("ts <= #date")
.groupby(['type','id'])['version']
.max()
.reset_index())
return pandas.merge(datedelems, history, on=['type','id','version'])
oldelem = datedelems(elements, "2008-02-01")
oldelem.head()
I have deleted the variable date, changed the format of the date,...
Error:
Traceback (most recent call last):
File "/Users/.../PycharmProjects/pythonProject11/venv/lib/python3.10/site-packages/pandas/core/arrays/datetimelike.py", line 582, in _validate_comparison_value
self._check_compatible_with(other)
File "/Users/.../PycharmProjects/pythonProject11/venv/lib/python3.10/site-packages/pandas/core/arrays/datetimes.py", line 461, in _check_compatible_with
self._assert_tzawareness_compat(other)
File "/Users/.../PycharmProjects/pythonProject11/venv/lib/python3.10/site-packages/pandas/core/arrays/datetimes.py", line 698, in _assert_tzawareness_compat
raise TypeError(
TypeError: Cannot compare tz-naive and tz-aware datetime-like objects
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/.../PycharmProjects/pythonProject11/venv/lib/python3.10/site-packages/pandas/core/arrays/datetimelike.py", line 1054, in _cmp_method
other = self._validate_comparison_value(other)
File "/Users/.../PycharmProjects/pythonProject11/venv/lib/python3.10/site-packages/pandas/core/arrays/datetimelike.py", line 585, in _validate_comparison_value
raise InvalidComparison(other) from err
pandas.core.arrays.datetimelike.InvalidComparison: 2008-02-01 00:00:00
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/.../PycharmProjects/pythonProject11/main.py", line 47, in <module>
oldelem = datedelems(elements, "2008-02-01")
File "/Users/.../PycharmProjects/pythonProject11/main.py", line 41, in datedelems
datedelems = (history.query("ts <= #date")
File "/Users/.../PycharmProjects/pythonProject11/venv/lib/python3.10/site-packages/pandas/util/_decorators.py", line 331, in wrapper
return func(*args, **kwargs)
File "/Users/.../PycharmProjects/pythonProject11/venv/lib/python3.10/site-packages/pandas/core/frame.py", line 4463, in query
res = self.eval(expr, **kwargs)
File "/Users/.../PycharmProjects/pythonProject11/venv/lib/python3.10/site-packages/pandas/util/_decorators.py", line 331, in wrapper
return func(*args, **kwargs)
File "/Users/.../PycharmProjects/pythonProject11/venv/lib/python3.10/site-packages/pandas/core/frame.py", line 4601, in eval
return _eval(expr, inplace=inplace, **kwargs)
File "/Users/.../PycharmProjects/pythonProject11/venv/lib/python3.10/site-packages/pandas/core/computation/eval.py", line 353, in eval
parsed_expr = Expr(expr, engine=engine, parser=parser, env=env)
File "/Users/.../PycharmProjects/pythonProject11/venv/lib/python3.10/site-packages/pandas/core/computation/expr.py", line 813, in __init__
self.terms = self.parse()
File "/Users/.../PycharmProjects/pythonProject11/venv/lib/python3.10/site-packages/pandas/core/computation/expr.py", line 832, in parse
return self._visitor.visit(self.expr)
File "/Users/.../PycharmProjects/pythonProject11/venv/lib/python3.10/site-packages/pandas/core/computation/expr.py", line 415, in visit
return visitor(node, **kwargs)
File "/Users/.../PycharmProjects/pythonProject11/venv/lib/python3.10/site-packages/pandas/core/computation/expr.py", line 421, in visit_Module
return self.visit(expr, **kwargs)
File "/Users/.../PycharmProjects/pythonProject11/venv/lib/python3.10/site-packages/pandas/core/computation/expr.py", line 415, in visit
return visitor(node, **kwargs)
File "/Users/.../PycharmProjects/pythonProject11/venv/lib/python3.10/site-packages/pandas/core/computation/expr.py", line 424, in visit_Expr
return self.visit(node.value, **kwargs)
File "/Users/.../PycharmProjects/pythonProject11/venv/lib/python3.10/site-packages/pandas/core/computation/expr.py", line 415, in visit
return visitor(node, **kwargs)
File "/Users/.../PycharmProjects/pythonProject11/venv/lib/python3.10/site-packages/pandas/core/computation/expr.py", line 723, in visit_Compare
return self.visit(binop)
File "/Users/.../PycharmProjects/pythonProject11/venv/lib/python3.10/site-packages/pandas/core/computation/expr.py", line 415, in visit
return visitor(node, **kwargs)
File "/Users/.../PycharmProjects/pythonProject11/venv/lib/python3.10/site-packages/pandas/core/computation/expr.py", line 538, in visit_BinOp
return self._maybe_evaluate_binop(op, op_class, left, right)
File "/Users/.../PycharmProjects/pythonProject11/venv/lib/python3.10/site-packages/pandas/core/computation/expr.py", line 520, in _maybe_evaluate_binop
return self._maybe_eval(res, self.binary_ops)
File "/Users/.../PycharmProjects/pythonProject11/venv/lib/python3.10/site-packages/pandas/core/computation/expr.py", line 492, in _maybe_eval
return binop.evaluate(
File "/Users/.../PycharmProjects/pythonProject11/venv/lib/python3.10/site-packages/pandas/core/computation/ops.py", line 427, in evaluate
res = self(env)
File "/Users/.../PycharmProjects/pythonProject11/venv/lib/python3.10/site-packages/pandas/core/computation/ops.py", line 407, in __call__
return self.func(left, right)
File "/Users/.../PycharmProjects/pythonProject11/venv/lib/python3.10/site-packages/pandas/core/ops/common.py", line 72, in new_method
return method(self, other)
File "/Users/.../PycharmProjects/pythonProject11/venv/lib/python3.10/site-packages/pandas/core/arraylike.py", line 54, in __le__
return self._cmp_method(other, operator.le)
File "/Users/.../PycharmProjects/pythonProject11/venv/lib/python3.10/site-packages/pandas/core/series.py", line 6243, in _cmp_method
res_values = ops.comparison_op(lvalues, rvalues, op)
File "/Users/.../PycharmProjects/pythonProject11/venv/lib/python3.10/site-packages/pandas/core/ops/array_ops.py", line 273, in comparison_op
res_values = op(lvalues, rvalues)
File "/Users/.../PycharmProjects/pythonProject11/venv/lib/python3.10/site-packages/pandas/core/ops/common.py", line 72, in new_method
return method(self, other)
File "/Users/.../PycharmProjects/pythonProject11/venv/lib/python3.10/site-packages/pandas/core/arraylike.py", line 54, in __le__
return self._cmp_method(other, operator.le)
File "/Users/.../PycharmProjects/pythonProject11/venv/lib/python3.10/site-packages/pandas/core/arrays/datetimelike.py", line 1056, in _cmp_method
return invalid_comparison(self, other, op)
File "/Users/.../PycharmProjects/pythonProject11/venv/lib/python3.10/site-packages/pandas/core/ops/invalid.py", line 36, in invalid_comparison
raise TypeError(f"Invalid comparison between dtype={left.dtype} and {typ}")
TypeError: Invalid comparison between dtype=datetime64[ns, UTC] and Timestamp
Process finished with exit code 1

jupyter_client.kernelspec.NoSuchKernel: No such kernel named PySpark

Am trying to execute Jupyter notebook from command line. Am currently using the docker image provided in below link
https://hub.docker.com/r/jupyter/pyspark-notebook
When i try to execute below in command line it fails.
jupyter nbconvert --to notebook --ExecutePreprocessor.kernel_name=PySpark --ExecutePreprocessor.timeout=3600 --execute notebooks/sample-notebook.ipynb
Below is the error message
[NbConvertApp] Converting notebook notebooks/sample-notebook.ipynb to notebook
Traceback (most recent call last):
File "/opt/conda/bin/jupyter-nbconvert", line 11, in <module>
sys.exit(main())
File "/opt/conda/lib/python3.7/site-packages/jupyter_core/application.py", line 270, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/opt/conda/lib/python3.7/site-packages/traitlets/config/application.py", line 664, in launch_instance
app.start()
File "/opt/conda/lib/python3.7/site-packages/nbconvert/nbconvertapp.py", line 340, in start
self.convert_notebooks()
File "/opt/conda/lib/python3.7/site-packages/nbconvert/nbconvertapp.py", line 510, in convert_notebooks
self.convert_single_notebook(notebook_filename)
File "/opt/conda/lib/python3.7/site-packages/nbconvert/nbconvertapp.py", line 481, in convert_single_notebook
output, resources = self.export_single_notebook(notebook_filename, resources, input_buffer=input_buffer)
File "/opt/conda/lib/python3.7/site-packages/nbconvert/nbconvertapp.py", line 410, in export_single_notebook
output, resources = self.exporter.from_filename(notebook_filename, resources=resources)
File "/opt/conda/lib/python3.7/site-packages/nbconvert/exporters/exporter.py", line 179, in from_filename
return self.from_file(f, resources=resources, **kw)
File "/opt/conda/lib/python3.7/site-packages/nbconvert/exporters/exporter.py", line 197, in from_file
return self.from_notebook_node(nbformat.read(file_stream, as_version=4), resources=resources, **kw)
File "/opt/conda/lib/python3.7/site-packages/nbconvert/exporters/notebook.py", line 32, in from_notebook_node
nb_copy, resources = super(NotebookExporter, self).from_notebook_node(nb, resources, **kw)
File "/opt/conda/lib/python3.7/site-packages/nbconvert/exporters/exporter.py", line 139, in from_notebook_node
nb_copy, resources = self._preprocess(nb_copy, resources)
File "/opt/conda/lib/python3.7/site-packages/nbconvert/exporters/exporter.py", line 316, in _preprocess
nbc, resc = preprocessor(nbc, resc)
File "/opt/conda/lib/python3.7/site-packages/nbconvert/preprocessors/base.py", line 47, in __call__
return self.preprocess(nb, resources)
File "/opt/conda/lib/python3.7/site-packages/nbconvert/preprocessors/execute.py", line 403, in preprocess
with self.setup_preprocessor(nb, resources, km=km):
File "/opt/conda/lib/python3.7/contextlib.py", line 112, in __enter__
return next(self.gen)
File "/opt/conda/lib/python3.7/site-packages/nbconvert/preprocessors/execute.py", line 345, in setup_preprocessor
self.km, self.kc = self.start_new_kernel(**kwargs)
File "/opt/conda/lib/python3.7/site-packages/nbconvert/preprocessors/execute.py", line 291, in start_new_kernel
km.start_kernel(extra_arguments=self.extra_arguments, **kwargs)
File "/opt/conda/lib/python3.7/site-packages/jupyter_client/manager.py", line 301, in start_kernel
kernel_cmd, kw = self.pre_start_kernel(**kw)
File "/opt/conda/lib/python3.7/site-packages/jupyter_client/manager.py", line 254, in pre_start_kernel
kernel_cmd = self.format_kernel_cmd(extra_arguments=extra_arguments)
File "/opt/conda/lib/python3.7/site-packages/jupyter_client/manager.py", line 178, in format_kernel_cmd
cmd = self.kernel_spec.argv + extra_arguments
File "/opt/conda/lib/python3.7/site-packages/jupyter_client/manager.py", line 84, in kernel_spec
self._kernel_spec = self.kernel_spec_manager.get_kernel_spec(self.kernel_name)
File "/opt/conda/lib/python3.7/site-packages/jupyter_client/kernelspec.py", line 235, in get_kernel_spec
raise NoSuchKernel(kernel_name)
jupyter_client.kernelspec.NoSuchKernel: No such kernel named PySpark

django-simple-history 1.9 break unittests

When I run unittests with django-simple-history==1.6.0, it runs fine but with
django-simple-history==1.9.0 it breaks the unittests.
Any ideas how to fix this?
Creating test database for alias 'default'...
Traceback (most recent call last):
File "manage.py", line 12, in <module>
execute_from_command_line(sys.argv)
File "/home/me/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/home/me/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/me/venv/lib/python2.7/site-packages/django/core/management/commands/test.py", line 30, in run_from_argv
super(Command, self).run_from_argv(argv)
File "/home/me/venv/lib/python2.7/site-packages/django/core/management/base.py", line 390, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/me/venv/lib/python2.7/site-packages/django/core/management/commands/test.py", line 74, in execute
super(Command, self).execute(*args, **options)
File "/home/me/venv/lib/python2.7/site-packages/django/core/management/base.py", line 441, in execute
output = self.handle(*args, **options)
File "/home/me/venv/lib/python2.7/site-packages/django/core/management/commands/test.py", line 90, in handle
failures = test_runner.run_tests(test_labels)
File "/home/me/venv/lib/python2.7/site-packages/django/test/runner.py", line 210, in run_tests
old_config = self.setup_databases()
File "/home/me/venv/lib/python2.7/site-packages/django/test/runner.py", line 166, in setup_databases
**kwargs
File "/home/me/venv/lib/python2.7/site-packages/django/test/runner.py", line 370, in setup_databases
serialize=connection.settings_dict.get("TEST", {}).get("SERIALIZE", True),
File "/home/me/venv/lib/python2.7/site-packages/django/db/backends/base/creation.py", line 376, in create_test_db
self.connection._test_serialized_contents = self.serialize_db_to_string()
File "/home/me/venv/lib/python2.7/site-packages/django/db/backends/base/creation.py", line 413, in serialize_db_to_string
serializers.serialize("json", get_objects(), indent=None, stream=out)
File "/home/me/venv/lib/python2.7/site-packages/django/core/serializers/__init__.py", line 129, in serialize
s.serialize(queryset, **options)
File "/home/me/venv/lib/python2.7/site-packages/django/core/serializers/base.py", line 52, in serialize
for obj in queryset:
File "/home/me/venv/lib/python2.7/site-packages/django/db/backends/base/creation.py", line 409, in get_objects
for obj in queryset.iterator():
File "/home/me/venv/lib/python2.7/site-packages/django/db/models/query.py", line 238, in iterator
results = compiler.execute_sql()
File "/home/me/venv/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 829, in execute_sql
cursor.execute(sql, params)
File "/home/me/venv/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/home/me/venv/lib/python2.7/site-packages/django/db/utils.py", line 97, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/home/me/venv/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/home/me/venv/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 318, in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: no such column: myapp_historicalbook.history_change_reason
I got it. I had to remove my migration folder in order to be able to run the unit tests.

TypeError: file() argument 1 must be encoded string without NULL bytes, not str odoo

the python version is 2.8.2 and using it in eclipse. I am getting this error when I am trying to execute the following command:
The function is:
#api.one
#api.depends('image')
def _compute_image_details(self):
if self.image:
image_content = self.image.decode('base64')
print type(self.image)
print type(image_content)
# File size
self.size = len(image_content)
# Camera make and model from EXIF tags
img = PIL.Image.open(image_content)
exif_tags = img._getexif()
# 0x010f is a numeric code for the "make" exif field
# You can find a list of fields here: exiv2.org/tags.html
self.camera_maker = exif_tags.get(0x010f)
The error which is raised is:
Traceback (most recent call last):
File "/home/next/WORKSPACE/odoo-8.0/openerp/http.py", line 537, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/next/WORKSPACE/odoo-8.0/openerp/http.py", line 574, in dispatch
result = self._call_function(**self.params)
File "/home/next/WORKSPACE/odoo-8.0/openerp/http.py", line 310, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/next/WORKSPACE/odoo-8.0/openerp/service/model.py", line 113, in wrapper
return f(dbname, *args, **kwargs)
File "/home/next/WORKSPACE/odoo-8.0/openerp/http.py", line 307, in checked_call
return self.endpoint(*a, **kw)
File "/home/next/WORKSPACE/odoo-8.0/openerp/http.py", line 803, in __call__
return self.method(*args, **kw)
File "/home/next/WORKSPACE/odoo-8.0/openerp/http.py", line 403, in response_wrap
response = f(*args, **kw)
File "/home/next/WORKSPACE/odoo-8.0/addons/web/controllers/main.py", line 944, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/home/next/WORKSPACE/odoo-8.0/addons/web/controllers/main.py", line 936, in _call_kw
return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
File "/home/next/WORKSPACE/odoo-8.0/openerp/api.py", line 241, in wrapper
return old_api(self, *args, **kwargs)
File "/home/next/WORKSPACE/odoo-8.0/openerp/api.py", line 363, in old_api
result = method(recs, *args, **kwargs)
File "/home/next/WORKSPACE/odoo-8.0/openerp/models.py", line 5873, in onchange
newval = record[name]
File "/home/next/WORKSPACE/odoo-8.0/openerp/models.py", line 5571, in __getitem__
return self._fields[key].__get__(self, type(self))
File "/home/next/WORKSPACE/odoo-8.0/openerp/fields.py", line 820, in __get__
self.determine_draft_value(record)
File "/home/next/WORKSPACE/odoo-8.0/openerp/fields.py", line 928, in determine_draft_value
self._compute_value(record)
File "/home/next/WORKSPACE/odoo-8.0/openerp/fields.py", line 867, in _compute_value
self.compute(records)
File "/home/next/WORKSPACE/odoo-8.0/openerp/api.py", line 239, in wrapper
return new_api(self, *args, **kwargs)
File "/home/next/WORKSPACE/odoo-8.0/openerp/api.py", line 397, in new_api
result = [method(rec, *args, **kwargs) for rec in self]
File "/home/next/WORKSPACE/odoo-8.0/addons/transform_webservice_example/image_example.py", line 33, in _compute_image_details
img = PIL.Image.open(image_content)
File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 1955, in open
fp = __builtin__.open(fp, "rb")
TypeError: file() argument 1 must be encoded string without NULL bytes, not str
Please help me with this issue.
The other references say about the URL of the file. This is different scenario.
You're trying to open the base64 decoded contents of the file, you're supposed to open the file itself.
PIL.Image.open(self.image)
take this for example, to reproduce the error you're getting
>>> open('\0')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: file() argument 1 must be encoded string without NULL bytes, not str
>>>
the character '\0' is seen as a NullByte which the decoded image contains