Skip to content
Snippets Groups Projects
Commit 36e3ae8c authored by Tobias Westphal's avatar Tobias Westphal
Browse files

Update jsonparse.py:

Dynamischer Pfad zum JSON-Model. Die als Argument übergebene JSON-File muss sich aktuell im gleichen Folder befinden.
parent 6cb783f0
No related branches found
No related tags found
No related merge requests found
import json
import os
import sys
from collections import namedtuple
......@@ -82,7 +84,15 @@ def changerange(string):
print(string)
with open("soil-dummies/src/robot/model.json") as file:
try:
JSON_MODEL = sys.argv[1][:-5]
if not os.path.exists(os.path.join('..', 'SOIL OPC-UA', f'{JSON_MODEL}.json')):
raise Exception()
except Exception as e:
print('You must provide a file from the folder to be used as root file of the parsing, e.g., "python jsonparser.py model.json".')
exit()
with open(f'{JSON_MODEL}.json') as file:
#robot = json.dumps(file.read())
robotload = json.loads(file.read())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment