AttributeError: 'S3File' object has not attribute 'getvalue', while running to_csv - amazon-s3

I'm running to_csv command as follows to an ouput file on a s3 bucket with ServerSideEncryption enabled:
to_csv("s3://mys3bucket/result.csv",
storage_option={'s3_additional_kwargs':
{'ServerSideEncryption': 'AES256'}})
I'm getting the following attribute error:
File "/usr/lib/python2.7/site-packages/dask/dataframe/core.py", line 1091, in to_csv
return to_csv(self, filename, **kwargs)
File "/usr/lib/python2.7/site-packages/dask/dataframe/io/csv.py", line 577, in to_csv
delayed(values).compute(get=get, scheduler=scheduler)
File "/usr/lib/python2.7/site-packages/dask/base.py", line 156, in compute
(result,) = compute(self, traverse=False, **kwargs)
File "/usr/lib/python2.7/site-packages/dask/base.py", line 400, in compute
results = schedule(dsk, keys, **kwargs)
File "/usr/lib/python2.7/site-packages/distributed/client.py", line 2159, in get
direct=direct)
File "/usr/lib/python2.7/site-packages/distributed/client.py", line 1562, in gather
asynchronous=asynchronous)
File "/usr/lib/python2.7/site-packages/distributed/client.py", line 652, in sync
return sync(self.loop, func, *args, **kwargs)
File "/usr/lib/python2.7/site-packages/distributed/utils.py", line 275, in sync
six.reraise(*error[0])
File "/usr/lib/python2.7/site-packages/distributed/utils.py", line 260, in f
result[0] = yield make_coro()
File "/usr/lib64/python2.7/site-packages/tornado/gen.py", line 1099, in run
value = future.result()
File "/usr/lib64/python2.7/site-packages/tornado/concurrent.py", line 260, in result
raise_exc_info(self._exc_info)
File "/usr/lib64/python2.7/site-packages/tornado/gen.py", line 1107, in run
yielded = self.gen.throw(*exc_info)
File "/usr/lib/python2.7/site-packages/distributed/client.py", line 1439, in _gather
traceback)
File "/usr/lib/python2.7/site-packages/dask/dataframe/io/csv.py", line 439, in _to_csv_chunk
df.to_csv(f, **kwargs)
File "/usr/lib64/python2.7/site-packages/pandas/core/frame.py", line 1745, in to_csv
formatter.save()
File "/usr/lib64/python2.7/site-packages/pandas/io/formats/csvs.py", line 161, in save
buf = f.getvalue()
File "/usr/lib/python2.7/site-packages/dask/bytes/utils.py", line 136, in __getattr__
return getattr(self.file, key)
AttributeError: 'S3File' object has no attribute 'getvalue'
I searched for this error, but couldn't find a relevant solution.
Do you have any idea?

Related

Unable to load Tables in SQL Editor (Superset)

I am running Superset using gunicorn and using redis for cache.
kindly help me fix this, let me know if any configuration file is required
2022-10-17 07:25:40,852:ERROR:superset.views.base:value is not an integer or out of range
Traceback (most recent call last):
File "/home/ubuntu/.local/lib/python3.8/site-packages/superset/views/base.py", line 185, in wraps
return f(self, *args, **kwargs)
File "/home/ubuntu/.local/lib/python3.8/site-packages/flask_appbuilder/security/decorators.py", line 175, in wraps
return f(self, *args, **kwargs)
File "/home/ubuntu/.local/lib/python3.8/site-packages/superset/utils/log.py", line 245, in wrapper
value = f(*args, **kwargs)
File "/home/ubuntu/.local/lib/python3.8/site-packages/superset/views/core.py", line 1122, in tables
for datasource_name in database.get_all_table_names_in_schema(
File "/home/ubuntu/.local/lib/python3.8/site-packages/superset/utils/cache.py", line 146, in wrapped_f
cache.set(cache_key, obj, timeout=kwargs.get("cache_timeout"))
File "/home/ubuntu/.local/lib/python3.8/site-packages/flask_caching/__init__.py", line 194, in set
return self.cache.set(*args, **kwargs)
File "/home/ubuntu/.local/lib/python3.8/site-packages/cachelib/redis.py", line 105, in set
result = self._client.setex(
File "/home/ubuntu/.local/lib/python3.8/site-packages/redis/commands/core.py", line 2245, in setex
return self.execute_command("SETEX", name, time, value)
File "/home/ubuntu/.local/lib/python3.8/site-packages/redis/client.py", line 1238, in execute_command
return conn.retry.call_with_retry(
File "/home/ubuntu/.local/lib/python3.8/site-packages/redis/retry.py", line 46, in call_with_retry
return do()
File "/home/ubuntu/.local/lib/python3.8/site-packages/redis/client.py", line 1239, in <lambda>
lambda: self._send_command_parse_response(
File "/home/ubuntu/.local/lib/python3.8/site-packages/redis/client.py", line 1215, in _send_command_parse_response
return self.parse_response(conn, command_name, **options)
File "/home/ubuntu/.local/lib/python3.8/site-packages/redis/client.py", line 1254, in parse_response
response = connection.read_response()
File "/home/ubuntu/.local/lib/python3.8/site-packages/redis/connection.py", line 839, in read_response
raise response
redis.exceptions.ResponseError: value is not an integer or out of range

Odoo showing KeyError: 'last_path_node' after migrate from v12 to v13 with Openupgrade

I migrate my odoo instance from v12 to v13 using Openupgrade without errors. I also made change in my code and update my custom modules using
python3 odoo-bin --addons-path="./addons, ./extra_addons, ./OCA/contract" -p 8069 -d database_name -u module_name
also without error. My odoo instance is apparently loading without error, I can even see the odoo main interface but when and click an element from the main menu (lets say "contacts") it shows "Internal Server Error" and when I check the logs I can see the following errors " path = options['last_path_node']
KeyError: 'last_path_node'"
Where is the full log of the error
**Contexto del error:
Vista `App Drawer - Web Client`
[view_id: 941, xml_id: web_responsive.webclient_bootstrap, model: n/a, parent_id: 178]
2022-09-08 13:33:39,610 19400 INFO wimax13 werkzeug: 127.0.0.1 - - [08/Sep/2022 13:33:39] "GET /web HTTP/1.1" 500 - 386 0.534 1.152
2022-09-08 13:33:39,973 19400 ERROR wimax13 werkzeug: Error on request:
Traceback (most recent call last):
File "/home/ernesto/Programming/odoo/wimax13/lib/python3.6/site-packages/werkzeug/serving.py", line 270, in run_wsgi
execute(self.server.app)
File "/home/ernesto/Programming/odoo/wimax13/lib/python3.6/site-packages/werkzeug/serving.py", line 258, in execute
application_iter = app(environ, start_response)
File "/home/ernesto/Programming/odoo/wimax13/odoo/service/server.py", line 439, in app
return self.app(e, s)
File "/home/ernesto/Programming/odoo/wimax13/odoo/service/wsgi_server.py", line 142, in application
return application_unproxied(environ, start_response)
File "/home/ernesto/Programming/odoo/wimax13/odoo/service/wsgi_server.py", line 117, in application_unproxied
result = odoo.http.root(environ, start_response)
File "/home/ernesto/Programming/odoo/wimax13/odoo/http.py", line 1287, in __call__
return self.dispatch(environ, start_response)
File "/home/ernesto/Programming/odoo/wimax13/odoo/http.py", line 1257, in __call__
return self.app(environ, start_wrapped)
File "/home/ernesto/Programming/odoo/wimax13/lib/python3.6/site-packages/werkzeug/wsgi.py", line 766, in __call__
return self.app(environ, start_response)
File "/home/ernesto/Programming/odoo/wimax13/odoo/http.py", line 1457, in dispatch
result = ir_http._dispatch()
File "/home/ernesto/Programming/odoo/wimax13/addons/website/models/ir_http.py", line 172, in _dispatch
response = super(Http, cls)._dispatch()
File "/home/ernesto/Programming/odoo/wimax13/addons/auth_signup/models/ir_http.py", line 19, in _dispatch
return super(Http, cls)._dispatch()
File "/home/ernesto/Programming/odoo/wimax13/addons/web_editor/models/ir_http.py", line 21, in _dispatch
return super(IrHttp, cls)._dispatch()
File "/home/ernesto/Programming/odoo/wimax13/addons/utm/models/ir_http.py", line 29, in _dispatch
response = super(IrHttp, cls)._dispatch()
File "/home/ernesto/Programming/odoo/wimax13/addons/http_routing/models/ir_http.py", line 519, in _dispatch
result = super(IrHttp, cls)._dispatch()
File "/home/ernesto/Programming/odoo/wimax13/odoo/addons/base/models/ir_http.py", line 238, in _dispatch
return cls._handle_exception(e)
File "/home/ernesto/Programming/odoo/wimax13/addons/utm/models/ir_http.py", line 34, in _handle_exception
response = super(IrHttp, cls)._handle_exception(exc)
File "/home/ernesto/Programming/odoo/wimax13/addons/http_routing/models/ir_http.py", line 610, in _handle_exception
return super(IrHttp, cls)._handle_exception(exception)
File "/home/ernesto/Programming/odoo/wimax13/odoo/addons/base/models/ir_http.py", line 206, in _handle_exception
return request._handle_exception(exception)
File "/home/ernesto/Programming/odoo/wimax13/odoo/http.py", line 750, in _handle_exception
return super(HttpRequest, self)._handle_exception(exception)
File "/home/ernesto/Programming/odoo/wimax13/odoo/http.py", line 310, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/home/ernesto/Programming/odoo/wimax13/odoo/tools/pycompat.py", line 14, in reraise
raise value
File "/home/ernesto/Programming/odoo/wimax13/odoo/addons/base/models/ir_http.py", line 234, in _dispatch
result = request.dispatch()
File "/home/ernesto/Programming/odoo/wimax13/odoo/http.py", line 809, in dispatch
r = self._call_function(**self.params)
File "/home/ernesto/Programming/odoo/wimax13/odoo/http.py", line 350, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/ernesto/Programming/odoo/wimax13/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/home/ernesto/Programming/odoo/wimax13/odoo/http.py", line 342, in checked_call
result.flatten()
File "/home/ernesto/Programming/odoo/wimax13/odoo/http.py", line 1236, in flatten
self.response.append(self.render())
File "/home/ernesto/Programming/odoo/wimax13/odoo/http.py", line 1229, in render
return env["ir.ui.view"].render_template(self.template, self.qcontext)
File "/home/ernesto/Programming/odoo/wimax13/odoo/addons/base/models/ir_ui_view.py", line 1191, in render_template
return self.browse(self.get_view_id(template)).render(values, engine)
File "/home/ernesto/Programming/odoo/wimax13/addons/website/models/ir_ui_view.py", line 336, in render
return super(View, self).render(values, engine=engine, minimal_qcontext=minimal_qcontext)
File "/home/ernesto/Programming/odoo/wimax13/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 "/home/ernesto/Programming/odoo/wimax13/odoo/addons/base/models/ir_ui_view.py", line 1199, in render
return self.env[engine].render(self.id, qcontext)
File "/home/ernesto/Programming/odoo/wimax13/odoo/addons/base/models/ir_qweb.py", line 58, in render
result = super(IrQWeb, self).render(id_or_xml_id, values=values, **context)
File "/home/ernesto/Programming/odoo/wimax13/odoo/addons/base/models/qweb.py", line 260, in render
self.compile(template, options)(self, body.append, values or {})
File "<decorator-gen-54>", line 2, in compile
File "/home/ernesto/Programming/odoo/wimax13/odoo/tools/cache.py", line 90, in lookup
value = d[key] = self.method(*args, **kwargs)
File "/home/ernesto/Programming/odoo/wimax13/odoo/addons/base/models/ir_qweb.py", line 113, in compile
return super(IrQWeb, self).compile(id_or_xml_id, options=options)
File "/home/ernesto/Programming/odoo/wimax13/odoo/addons/base/models/qweb.py", line 277, in compile
element, document = self.get_template(template, options)
File "/home/ernesto/Programming/odoo/wimax13/odoo/addons/base/models/qweb.py", line 364, in get_template
path = options['last_path_node']
KeyError: 'last_path_node' - - -**
Based on the third line of your Traceback, your error seems to be related with this view:
view_id: 941, xml_id: web_responsive.webclient_bootstrap
You can access this view using its id: 941 in this kind of url:
https://your-oerp.odoo.com/web?#id=941&action=28&model=ir.ui.view&view_type=form
to provide me its content... to investigate the error
Is this view (with relativ high id: 941) "not native" / part of your custom module ?
On the other hand, this view name (id:941): "web_responsive.webclient_bootstrap" doesn t exist in Odoo 13 and seems to have been replaced:
In Odoo 13, the existing bootstrap-related views are:
web._assets_bootstrap
web.webclient_bootstrap
web_enterprise.webclient_bootstrap
web_studio.webclient_bootstrap

I'm trying to import CSV file using pandas, But I'm getting Error

C:\Users\Misti\PycharmProjects\pythonProject\venv\Scripts\python.exe C:/Users/Misti/PycharmProjects/pythonProject/main.py
Traceback (most recent call last):
File "C:/Users/Misti/PycharmProjects/pythonProject/main.py", line 2, in <module>
df = pd.read_csv('milestone2.csv')
File "C:\Users\Misti\PycharmProjects\pythonProject\venv\lib\site-packages\pandas\util\_decorators.py", line 311, in wrapper
return func(*args, **kwargs)
File "C:\Users\Misti\PycharmProjects\pythonProject\venv\lib\site-packages\pandas\io\parsers\readers.py", line 586, in read_csv
return _read(filepath_or_buffer, kwds)
File "C:\Users\Misti\PycharmProjects\pythonProject\venv\lib\site-packages\pandas\io\parsers\readers.py", line 482, in _read
parser = TextFileReader(filepath_or_buffer, **kwds)
File "C:\Users\Misti\PycharmProjects\pythonProject\venv\lib\site-packages\pandas\io\parsers\readers.py", line 811, in __init__
self._engine = self._make_engine(self.engine)
File "C:\Users\Misti\PycharmProjects\pythonProject\venv\lib\site-packages\pandas\io\parsers\readers.py", line 1040, in _make_engine
return mapping[engine](self.f, **self.options) # type: ignore[call-arg]
File "C:\Users\Misti\PycharmProjects\pythonProject\venv\lib\site-packages\pandas\io\parsers\c_parser_wrapper.py", line 69, in __init__
self._reader = parsers.TextReader(self.handles.handle, **kwds)
File "pandas\_libs\parsers.pyx", line 549, in pandas._libs.parsers.TextReader.__cinit__
pandas.errors.EmptyDataError: No columns to parse from file
Process finished with exit code 1

pandas 1.3.3 to_feather giving ArrowMemoryError

I have a dataset of size around 270MB and I use the following to write to feather file:
df.reset_index().to_feather(feather_path)
This gives me an error :
File "C:\apps\Python\lib\site-packages\pandas\util\_decorators.py", line 207, in wrapper
return func(*args, **kwargs)
File "C:\apps\Python\lib\site-packages\pandas\core\frame.py", line 2519, in to_feather
to_feather(self, path, **kwargs)
File "C:\apps\Python\lib\site-packages\pandas\io\feather_format.py", line 87, in to_feather
feather.write_feather(df, handles.handle, **kwargs)
File "C:\apps\Python\lib\site-packages\pyarrow\feather.py", line 152, in write_feather
table = Table.from_pandas(df, preserve_index=False)
File "pyarrow\table.pxi", line 1553, in pyarrow.lib.Table.from_pandas
File "C:\apps\Python\lib\site-packages\pyarrow\pandas_compat.py", line 607, in dataframe_to_arrays
arrays[i] = maybe_fut.result()
File "C:\apps\Python\lib\concurrent\futures\_base.py", line 438, in result
return self.__get_result()
File "C:\apps\Python\lib\concurrent\futures\_base.py", line 390, in __get_result
raise self._exception
File "C:\apps\Python\lib\concurrent\futures\thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "C:\apps\Python\lib\site-packages\pyarrow\pandas_compat.py", line 575, in convert_column
result = pa.array(col, type=type_, from_pandas=True, safe=safe)
File "pyarrow\array.pxi", line 302, in pyarrow.lib.array
File "pyarrow\array.pxi", line 83, in pyarrow.lib._ndarray_to_array
File "pyarrow\error.pxi", line 114, in pyarrow.lib.check_status
pyarrow.lib.ArrowMemoryError: realloc of size 3221225472 failed
Note : This works well in PyCharm. No issues writing the feather file.
But when the python program is called in a Windows batch file like:
call python "myprogram.py"
and when I schedule the batch file in a task using Task Scheduler it fails with above memory error.
PyArrow version is 5.0.0 if that helps.
Any ideas please?

RASA init error : tensorflow.python.framework.errors_impl.InvalidArgumentError: assertion failed: [0] [Op:Assert] name: EagerVariableNameReuse

I am new to rasa . I installed rasa 2.4.1 in my windows 10, python 3.7.6 machine without any error . But when I initialise rasa project I get following error . I tried with multiple rasa2.x versions and multiple tensorflow installations . But no luck . Any help to resolve this issue is appreciated .
File "D:\NLP\rasa_env\Scripts\rasa.exe\__main__.py", line 7, in <module>
File "d:\nlp\rasa_env\lib\site-packages\rasa\__main__.py", line 116, in main
cmdline_arguments.func(cmdline_arguments)
File "d:\nlp\rasa_env\lib\site-packages\rasa\cli\scaffold.py", line 234, in run
init_project(args, path)
File "d:\nlp\rasa_env\lib\site-packages\rasa\cli\scaffold.py", line 129, in init_project
print_train_or_instructions(args, path)
File "d:\nlp\rasa_env\lib\site-packages\rasa\cli\scaffold.py", line 68, in print_train_or_instructions
training_result = rasa.train(domain, config, training_files, output)
File "d:\nlp\rasa_env\lib\site-packages\rasa\train.py", line 109, in train
loop,
File "d:\nlp\rasa_env\lib\site-packages\rasa\utils\common.py", line 308, in run_in_loop
result = loop.run_until_complete(f)
File "c:\users\kni9kor\anaconda3\lib\asyncio\base_events.py", line 583, in run_until_complete
return future.result()
File "d:\nlp\rasa_env\lib\site-packages\rasa\train.py", line 174, in train_async
finetuning_epoch_fraction=finetuning_epoch_fraction,
File "d:\nlp\rasa_env\lib\site-packages\rasa\train.py", line 353, in _train_async_internal
finetuning_epoch_fraction=finetuning_epoch_fraction,
File "d:\nlp\rasa_env\lib\site-packages\rasa\train.py", line 396, in _do_training
finetuning_epoch_fraction=finetuning_epoch_fraction,
File "d:\nlp\rasa_env\lib\site-packages\rasa\train.py", line 818, in _train_nlu_with_validated_data
**additional_arguments,
File "d:\nlp\rasa_env\lib\site-packages\rasa\nlu\train.py", line 116, in train
interpreter = trainer.train(training_data, **kwargs)
File "d:\nlp\rasa_env\lib\site-packages\rasa\nlu\model.py", line 209, in train
updates = component.train(working_data, self.config, **context)
File "d:\nlp\rasa_env\lib\site-packages\rasa\nlu\classifiers\diet_classifier.py", line 810, in train
self.model = self._instantiate_model_class(model_data)
File "d:\nlp\rasa_env\lib\site-packages\rasa\nlu\classifiers\diet_classifier.py", line 1132, in _instantiate_model_class
config=self.component_config,
File "d:\nlp\rasa_env\lib\site-packages\rasa\nlu\classifiers\diet_classifier.py", line 1146, in __init__
super().__init__("DIET", config, data_signature, label_data)
File "d:\nlp\rasa_env\lib\site-packages\rasa\utils\tensorflow\models.py", line 705, in __init__
checkpoint_model=config[CHECKPOINT_MODEL],
File "d:\nlp\rasa_env\lib\site-packages\rasa\utils\tensorflow\models.py", line 91, in __init__
super().__init__(**kwargs)
File "d:\nlp\rasa_env\lib\site-packages\tensorflow\python\training\tracking\base.py", line 457, in _method_wrapper
result = method(self, *args, **kwargs)
File "d:\nlp\rasa_env\lib\site-packages\tensorflow\python\keras\engine\training.py", line 308, in __init__
self._init_batch_counters()
File "d:\nlp\rasa_env\lib\site-packages\tensorflow\python\training\tracking\base.py", line 457, in _method_wrapper
result = method(self, *args, **kwargs)
File "d:\nlp\rasa_env\lib\site-packages\tensorflow\python\keras\engine\training.py", line 317, in _init_batch_counters
self._train_counter = variables.Variable(0, dtype='int64', aggregation=agg)
File "d:\nlp\rasa_env\lib\site-packages\tensorflow\python\ops\variables.py", line 262, in __call__
return cls._variable_v2_call(*args, **kwargs)
File "d:\nlp\rasa_env\lib\site-packages\tensorflow\python\ops\variables.py", line 256, in _variable_v2_call
shape=shape)
File "d:\nlp\rasa_env\lib\site-packages\tensorflow\python\ops\variables.py", line 237, in <lambda>
previous_getter = lambda **kws: default_variable_creator_v2(None, **kws)
File "d:\nlp\rasa_env\lib\site-packages\tensorflow\python\ops\variable_scope.py", line 2646, in default_variable_creator_v2
shape=shape)
File "d:\nlp\rasa_env\lib\site-packages\tensorflow\python\ops\variables.py", line 264, in __call__
return super(VariableMetaclass, cls).__call__(*args, **kwargs)
File "d:\nlp\rasa_env\lib\site-packages\tensorflow\python\ops\resource_variable_ops.py", line 1518, in __init__
distribute_strategy=distribute_strategy)
File "d:\nlp\rasa_env\lib\site-packages\tensorflow\python\ops\resource_variable_ops.py", line 1666, in _init_from_args
graph_mode=self._in_graph_mode)
File "d:\nlp\rasa_env\lib\site-packages\tensorflow\python\ops\resource_variable_ops.py", line 243, in eager_safe_variable_handle
shape, dtype, shared_name, name, graph_mode, initial_value)
File "d:\nlp\rasa_env\lib\site-packages\tensorflow\python\ops\resource_variable_ops.py", line 175, in _variable_handle_from_shape_and_dtype
math_ops.logical_not(exists), [exists], name="EagerVariableNameReuse")
File "d:\nlp\rasa_env\lib\site-packages\tensorflow\python\ops\gen_logging_ops.py", line 49, in _assert
_ops.raise_from_not_ok_status(e, name)
File "d:\nlp\rasa_env\lib\site-packages\tensorflow\python\framework\ops.py", line 6843, in raise_from_not_ok_status
six.raise_from(core._status_to_exception(e.code, message), None)
File "<string>", line 3, in raise_from
tensorflow.python.framework.errors_impl.InvalidArgumentError: assertion failed: [0] [Op:Assert] name: EagerVariableNameReuse
Possible Solutions:
1.Kill Concurrent python programs (like Jupyter notebooks) that is trying to access Tensorflow simultaneously.
2.Setting the environment variable TF_FORCE_GPU_ALLOW_GROWTH to true seems to make this issue disapper:
import os
os.environ['TF_FORCE_GPU_ALLOW_GROWTH'] = "true"
I have also attached following similar issues for reference which might help you out. link1 , link2, link3