Traceback (most recent call last):
File "viktor_connector/connector.pyx", line 295, in connector.Job.execute
File "viktor/core.pyx", line 1918, in viktor.core._handle_job
File "viktor/core.pyx", line 1864, in viktor.core._handle_job._handle_button
File "/home/user/src/app.py", line 867, in run_optimizer
project = pickle.load(output_file)
^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: Can't get attribute 'Project' on <module '__main__' (built-in)>
Thank you for your patience. Looking into this, I am suspecting that it could be due to the object type you receive from the generic_analysis.get_output_file. As indicated by the documentation, the following types can be expected from the get_output_file method: BytesIO, File or None. I suspect that the output_file object is a BytesIO. As per the pickle documentation, the load method expects a file object. Therefore, I would check if this would work if you try the following:
with output_file.getbuffer() as f:
project = pickle.load(f)
Hi mslootweg, unfortunately the suggested code change lead to this error.
Traceback (most recent call last):
File "viktor_connector/connector.pyx", line 295, in connector.Job.execute
File "viktor/core.pyx", line 1918, in viktor.core._handle_job
File "viktor/core.pyx", line 1864, in viktor.core._handle_job._handle_button
File "/home/user/src/app.py", line 868, in run_optimizer
project = pickle.load(f)
^^^^^^^^^^^^^^
TypeError: file must have 'read' and 'readline' attributes