Closed Rudra-sandeep closed 1 month ago
Hi, thank you for your questions and sorry for the delayed answer.
I think you're trying to use the local_file
backend, using JSON files.
Could it be that you copied them to the storage
directory directly? If you use the local_file
backend, you need to add the AAS data via the server (using the offical API endpoints, such as POST Submodel etc.)
Could you please provide your docker compose configuration or the command you use to start the server?
Yes I copied them to storage directory here is the command docker run -p 8081:80 -v .\storage:/storage basyx-python-sdk-http-server
Okay, thanks for the info. My suspicion is that there is a problem with one of the JSON files. Could you try to find just one JSON file in the storage directory with which you get this error and provide the file here?
Hello @Rudra-sandeep,
I tried to find out what the problem is. I suppose you copied submodel-template JSON files into the storage folder. This didn't work, because we expected a little bit different JSON files for the local_file backend.
Solution: I have now implemented a support of raw JSON, XML and AASX files in the storage folder. After the PR #2 is merged, you can build the docker image with the new code and use the local_file backend with JSON files.
If you want to try it out now, you can build container image from the branch feature/aasx_json_xml
and run it.
I am serving the json files but it throw below exception
return self.wsgi_app(environ, start_response) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1476, in wsgi_app response = self.handle_exception(e) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/flask_cors/extension.py", line 178, in wrapped_function return cors_after_request(app.make_response(f(*args, *kwargs))) ^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1473, in wsgi_app response = self.full_dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 883, in full_dispatch_request
return self.finalize_request(rv) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 902, in finalize_request response = self.make_response(rv) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1198, in make_response rv = self.response_class.force_type( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/werkzeug/wrappers/response.py", line 237, in force_type response = Response(run_wsgi_app(response, environ)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/werkzeug/test.py", line 1264, in run_wsgi_app
app_rv = app(environ, start_response) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/basyx/aas/adapter/http.py", line 533, in call
response: Response = self.handle_request(Request(environ)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/basyx/aas/adapter/http.py", line 684, in handle_request return endpoint(request, values, map_adapter=map_adapter) # type: ignore[operator] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/basyx/aas/adapter/http.py", line 832, in get_submodel_all return response_t(list(submodels), cursor=cursor, stripped=is_stripped_request(request)) ^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/basyx/aas/adapter/http.py", line 544, in _get_all_obj_of_type for obj in self.object_store: File "/usr/local/lib/python3.11/site-packages/basyx/aas/backend/local_file.py", line 209, in iter yield self.get_identifiable_by_hash(name.rstrip(".json")) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/basyx/aas/backend/local_file.py", line 114, in get_identifiable_by_hash obj = data["data"]