Can't follow an organization in ckan - server

I setup ckan from source from the latest docs. When a user tries to follow an organization the following error appears on the interface in my browser:
404 Not Found
The resource could not be found.
Incorrect group type
When I run the site using the "paster serve /etc/ckan/default/development.ini" command in my virtualenv I get the following error on my site when following an organization:
"Server Error
An internal server error occurred"
And I get the following traceback on my terminal:
Error - <type 'exceptions.OSError'>: [Errno 13] Permission denied: '/tmp/default/sessions/container_file_lock/4'
URL: http://127.0.0.1:5000/group/follow/80a2d460-6c4d-436d-8e3b-45b2efca0752
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/weberror/errormiddleware.py', line 171 in __call__
app_iter = self.application(environ, sr_checker)
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/webob/dec.py', line 147 in __call__
resp = self.call_func(req, *args, **self.kwargs)
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/webob/dec.py', line 208 in call_func
return self.func(req, *args, **kwargs)
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/fanstatic/publisher.py', line 234 in __call__
return request.get_response(self.app)
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/webob/request.py', line 1053 in get_response
application, catch_exc_info=False)
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/webob/request.py', line 1022 in call_application
app_iter = application(self.environ, start_response)
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/webob/dec.py', line 147 in __call__
resp = self.call_func(req, *args, **self.kwargs)
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/webob/dec.py', line 208 in call_func
return self.func(req, *args, **kwargs)
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/fanstatic/injector.py', line 54 in __call__
response = request.get_response(self.app)
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/webob/request.py', line 1053 in get_response
application, catch_exc_info=False)
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/webob/request.py', line 1022 in call_application
app_iter = application(self.environ, start_response)
File '/home/ammar/ckan/lib/default/src/ckan/ckan/config/middleware/pylons_app.py', line 245 in inner
result = application(environ, start_response)
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/beaker/middleware.py', line 73 in __call__
return self.app(environ, start_response)
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/beaker/middleware.py', line 155 in __call__
return self.wrap_app(environ, session_start_response)
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/routes/middleware.py', line 131 in __call__
response = self.app(environ, start_response)
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/pylons/wsgiapp.py', line 125 in __call__
response = self.dispatch(controller, environ, start_response)
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/pylons/wsgiapp.py', line 324 in dispatch
return controller(environ, start_response)
File '/home/ammar/ckan/lib/default/src/ckan/ckan/lib/base.py', line 292 in __call__
res = WSGIController.__call__(self, environ, start_response)
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/pylons/controllers/core.py', line 284 in __call__
return response(environ, self.start_response)
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/webob/exc.py', line 341 in __call__
return self.generate_response(environ, start_response)
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/webob/exc.py', line 333 in generate_response
return resp(environ, start_response)
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/webob/response.py', line 917 in __call__
start_response(self.status, headerlist)
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/beaker/middleware.py', line 149 in session_start_response
session.persist()
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/beaker/session.py', line 735 in persist
self._session().save()
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/beaker/session.py', line 415 in save
**self.namespace_args)
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/beaker/container.py', line 635 in __init__
OpenResourceNamespaceManager.__init__(self, namespace)
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/beaker/container.py', line 190 in __init__
self.access_lock = self.get_access_lock()
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/beaker/container.py', line 647 in get_access_lock
lock_dir=self.lock_dir)
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/beaker/synchronization.py', line 81 in file_synchronizer
return _synchronizer(identifier, FileSynchronizer, **kwargs)
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/beaker/synchronization.py', line 74 in _synchronizer
return _synchronizers.sync_get((identifier, cls), cls, identifier, **kwargs)
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/beaker/util.py', line 177 in sync_get
return self._create(key, createfunc, *args, **kwargs)
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/beaker/util.py', line 184 in _create
self[key] = obj = createfunc(*args, **kwargs)
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/beaker/synchronization.py', line 226 in __init__
extension='.lock'
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/beaker/util.py', line 238 in encoded_path
verify_directory(dir)
File '/usr/lib/ckan/default/local/lib/python2.7/site-packages/beaker/util.py', line 85 in verify_directory
os.makedirs(dir)
File '/usr/lib/ckan/default/lib/python2.7/os.py', line 150 in makedirs
makedirs(head, mode)
File '/usr/lib/ckan/default/lib/python2.7/os.py', line 157 in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/tmp/default/sessions/container_file_lock/4'
Please help.

The exception is saying that it's failing to create a directory due to file permissions. Try the same thing on the command-line:
mkdir -p /tmp/default/sessions/container_file_lock/4
Assuming that fails too, then you have two options:
change your file permissions to allow writes to /tmp
tell CKAN to store its beaker sessions elsewhere where it can write. The relevant CKAN configuration option is: cache_dir.

It's purely directory permissions
drwxr-xr-x. 3 root root 16 May 8 17:33 4
Make sure the permissions are like this.
Also, make sure you have correct user and group permissions on this directory(recursively)
/tmp/default/sessions/container_file_lock/4

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.

Data bricks:- Cannot display the predicted output by using ml flow registered model

I have created a model using diabetes dataset for prediction. I have trained, evaluated, logged and registered it as a new model in ML flow. Now I am trying to load the registered model and trying to predict on new data. All though I was able to predict the results. I am not able to display it. When I try to display using command .show() or display() it is throwing an error. What is the cause of the error? and How do I display the results?
Note: I have programmed using pure pyspark and all the ML flow operation was done on Data bricks
Code:-
model_details = mlflow.tracking.MlflowClient().get_latest_versions('model1',stages=['staging'])[0]
model = mlflow.pyfunc.spark_udf(spark,model_details.source)
input_df = sdf.drop('progression')
columns = list(map(lambda c: f"{c}", input_df.columns))
df = input_df.withColumn("progression", model(*columns))
df.show(truncate=False)
Error :-
PythonException: An exception was thrown from a UDF: 'Exception: Java gateway process exited before sending its port number'. Full traceback below:
PythonException Traceback (most recent call last)
<command-1343735193245452> in <module>
34 df = input_df.withColumn("progression", model(*columns))
35
---> 36 df.show(truncate=False)
/databricks/spark/python/pyspark/sql/dataframe.py in show(self, n, truncate, vertical)
441 print(self._jdf.showString(n, 20, vertical))
442 else:
--> 443 print(self._jdf.showString(n, int(truncate), vertical))
444
445 def __repr__(self):
/databricks/spark/python/lib/py4j-0.10.9-src.zip/py4j/java_gateway.py in __call__(self, *args)
1303 answer = self.gateway_client.send_command(command)
1304 return_value = get_return_value(
-> 1305 answer, self.gateway_client, self.target_id, self.name)
1306
1307 for temp_arg in temp_args:
/databricks/spark/python/pyspark/sql/utils.py in deco(*a, **kw)
131 # Hide where the exception came from that shows a non-Pythonic
132 # JVM exception message.
--> 133 raise_from(converted)
134 else:
135 raise
/databricks/spark/python/pyspark/sql/utils.py in raise_from(e)
PythonException: An exception was thrown from a UDF: 'Exception: Java gateway process exited before sending its port number'. Full traceback below:
Traceback (most recent call last):
File "/databricks/spark/python/pyspark/worker.py", line 654, in main
process()
File "/databricks/spark/python/pyspark/worker.py", line 646, in process
serializer.dump_stream(out_iter, outfile)
File "/databricks/spark/python/pyspark/sql/pandas/serializers.py", line 281, in dump_stream
timely_flush_timeout_ms=self.timely_flush_timeout_ms)
File "/databricks/spark/python/pyspark/sql/pandas/serializers.py", line 97, in dump_stream
for batch in iterator:
File "/databricks/spark/python/pyspark/sql/pandas/serializers.py", line 271, in init_stream_yield_batches
for series in iterator:
File "/databricks/spark/python/pyspark/worker.py", line 467, in mapper
result = tuple(f(*[a[o] for o in arg_offsets]) for (arg_offsets, f) in udfs)
File "/databricks/spark/python/pyspark/worker.py", line 467, in <genexpr>
result = tuple(f(*[a[o] for o in arg_offsets]) for (arg_offsets, f) in udfs)
File "/databricks/spark/python/pyspark/worker.py", line 111, in <lambda>
verify_result_type(f(*a)), len(a[0])), arrow_return_type)
File "/databricks/spark/python/pyspark/util.py", line 109, in wrapper
return f(*args, **kwargs)
File "/databricks/python/lib/python3.7/site-packages/mlflow/pyfunc/__init__.py", line 827, in predict
model = SparkModelCache.get_or_load(archive_path)
File "/databricks/python/lib/python3.7/site-packages/mlflow/pyfunc/spark_model_cache.py", line 64, in get_or_load
SparkModelCache._models[archive_path] = load_pyfunc(temp_dir)
File "/databricks/python/lib/python3.7/site-packages/mlflow/utils/annotations.py", line 43, in deprecated_func
return func(*args, **kwargs)
File "/databricks/python/lib/python3.7/site-packages/mlflow/pyfunc/__init__.py", line 693, in load_pyfunc
return load_model(model_uri, suppress_warnings)
File "/databricks/python/lib/python3.7/site-packages/mlflow/pyfunc/__init__.py", line 667, in load_model
model_impl = importlib.import_module(conf[MAIN])._load_pyfunc(data_path)
File "/databricks/python/lib/python3.7/site-packages/mlflow/spark.py", line 707, in _load_pyfunc
.master("local[1]")
File "/databricks/spark/python/pyspark/sql/session.py", line 189, in getOrCreate
sc = SparkContext.getOrCreate(sparkConf)
File "/databricks/spark/python/pyspark/context.py", line 384, in getOrCreate
SparkContext(conf=conf or SparkConf())
File "/databricks/spark/python/pyspark/context.py", line 134, in __init__
SparkContext._ensure_initialized(self, gateway=gateway, conf=conf)
File "/databricks/spark/python/pyspark/context.py", line 333, in _ensure_initialized
SparkContext._gateway = gateway or launch_gateway(conf)
File "/databricks/spark/python/pyspark/java_gateway.py", line 105, in launch_gateway
raise Exception("Java gateway process exited before sending its port number")
Exception: Java gateway process exited before sending its port number

Randomly getting error service unavailable for Google Assistant PushToTalk with Raspberry PI b model. How to fix error or how to handle this error

I have implemented Google Assistant in RaspBerry PI B model with the latest OS. I have followed google's instructions from here.
Audio sample testing working fine.
Many times it is working.
.asoundrc file
pcm.!default{
type asym
playback.pcm{type plug slave.pcm "hw:0"}
capture.pcm{type plug slave.pcm "hw:1"}
}
ctl.!default{
type hw
card 0
}
Error :-
INFO:root:Recording audio request.
File "/usr/lib/python3.5/runpy.py", line 193, in _run_module_as_main"__main__", mod_spec)
File "/usr/lib/python3.5/runpy.py", line 85, in _run_codeexec(code, run_globals)
File "/home/pi/teamaker/grpc/pushtotalk_back.py", line 337, in <module>main()
File "/home/pi/teamaker/grpc/env_local/lib/python3.5/site-packages/click/core.py", line 722, in __call__return self.main(*args, **kwargs)
File "/home/pi/teamaker/grpc/env_local/lib/python3.5/site-packages/click/core.py", line 697, in main\ rv = self.invoke(ctx)
File "/home/pi/teamaker/grpc/env_local/lib/python3.5/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/pi/teamaker/grpc/env_local/lib/python3.5/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/home/pi/teamaker/grpc/pushtotalk_back.py", line 326, in main
continue_conversation = assistant.converse()
File "/home/pi/teamaker/grpc/env_local/lib/python3.5/site-packages/tenacity/__init__.py", line 87, in wrapped_f
return r.call(f, *args, **kw)
File "/home/pi/teamaker/grpc/env_local/lib/python3.5/site-packages/tenacity/__init__.py", line 235, in call
do = self.iter(result=result, exc_info=exc_info)
File "/home/pi/teamaker/grpc/env_local/lib/python3.5/site-packages/tenacity/__init__.py", line 194, in iter
return fut.result()
File "/usr/lib/python3.5/concurrent/futures/_base.py", line 398, in result
return self.__get_result()
File "/usr/lib/python3.5/concurrent/futures/_base.py", line 357, in __get_result
raise self._exception
File "/home/pi/teamaker/grpc/env_local/lib/python3.5/site-packages/tenacity/__init__.py", line 238, in call
result = fn(*args, **kwargs)
File "/home/pi/teamaker/grpc/pushtotalk_back.py", line 145, in converse
self.conversation_stream.stop_playback()
File "/home/pi/teamaker/grpc/audio_helpers.py", line 288, in stop_playback
self._source.stop()
File "/home/pi/teamaker/grpc/audio_helpers.py", line 222, in stop
self._audio_stream.stop()
File "/home/pi/teamaker/grpc/env_local/lib/python3.5/site-packages/sounddevice.py", line 1235, in stop
_check(err, 'Error stopping stream')
File "/home/pi/teamaker/grpc/env_local/lib/python3.5/site-packages/sounddevice.py", line 2671, in _check
raise PortAudioError(msg)
sounddevice.PortAudioError: Error stopping stream: Unanticipated host API 0 error -77: 'File descriptor in bad state'

SSL: CERTIFICATE_VERIFY_FAILED when trying to use the Google Assistant SDK

When trying to authorize access to the Google Assistant API from my Raspberry Pi, I get an error of “SSLError” type, stating that the certificate verification has failed.
When I run:
python -m googlesamples.assistant.auth_helpers --client-secrets <path-to-secrets-file>
I get the following trace:
Traceback (most recent call last):
File "/usr/lib/python3.4/runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.4/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/pi/env/lib/python3.4/site-packages/googlesamples/assistant/auth_helpers/__main__.py", line 54, in <module>
main()
File "/home/pi/env/lib/python3.4/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/home/pi/env/lib/python3.4/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/home/pi/env/lib/python3.4/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/pi/env/lib/python3.4/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/home/pi/env/lib/python3.4/site-packages/googlesamples/assistant/auth_helpers/__main__.py", line 48, in main
creds = credentials_flow_interactive(client_secrets, scope)
File "/home/pi/env/lib/python3.4/site-packages/googlesamples/assistant/auth_helpers/__init__.py", line 47, in credentials_flow_interactive
flow.run_console()
File "/home/pi/env/lib/python3.4/site-packages/google_auth_oauthlib/flow.py", line 358, in run_console
self.fetch_token(code=code)
File "/home/pi/env/lib/python3.4/site-packages/google_auth_oauthlib/flow.py", line 235, in fetch_token
**kwargs)
File "/home/pi/env/lib/python3.4/site-packages/requests_oauthlib/oauth2_session.py", line 221, in fetch_token
verify=verify, proxies=proxies)
File "/home/pi/env/lib/python3.4/site-packages/requests/sessions.py", line 535, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/home/pi/env/lib/python3.4/site-packages/requests_oauthlib/oauth2_session.py", line 360, in request
headers=headers, data=data, **kwargs)
File "/home/pi/env/lib/python3.4/site-packages/requests/sessions.py", line 488, in request
resp = self.send(prep, **send_kwargs)
File "/home/pi/env/lib/python3.4/site-packages/requests/sessions.py", line 609, in send
r = adapter.send(request, **kwargs)
File "/home/pi/env/lib/python3.4/site-packages/requests/adapters.py", line 497, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)
How can I fix this?
One of the more likely issues for this to happen is your date and time being wrong. If your time/date is wrong, then try:
First change the date manually with the command date (see man page). For example:
sudo date -s "Mon Apr 24 13:30:00 PDT 2017"
If that works, but your time keeps desynchronizing with time, check out these instructions with several alternative solutions to ensure your time synchronizes properly.

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