Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Nextion2Text.py
Original file line number Diff line number Diff line change
Expand Up @@ -1805,7 +1805,7 @@ def dict_recursive_update(source: dict, target: dict) -> dict:
jsonFolder.mkdir(exist_ok=True)

if args.stats:
statFile = open(hmiTextFolder / Path(hmiFile.stem + "_Stats" + hmiTextFileExt), "w")
statFile = open(hmiTextFolder / Path(hmiFile.stem + "_Stats" + hmiTextFileExt), "w", encoding="utf-8")

texts = dict()
codeLines = dict()
Expand All @@ -1814,7 +1814,7 @@ def dict_recursive_update(source: dict, target: dict) -> dict:
compCount = dict()
compCount["Program.s"] = 0
if args.json:
with open(jsonFolder / Path("Program.s" + ".json"), "w") as f:
with open(jsonFolder / Path("Program.s" + ".json"), "w", encoding="utf-8") as f:
json.dump({"Program.s": hmi.programS}, f, indent=4)
for page in hmi.pages:
name = page.components[0].rawData["att"]["objname"]#str(page)
Expand All @@ -1827,12 +1827,12 @@ def dict_recursive_update(source: dict, target: dict) -> dict:
for c in page.components:
codeLines[name].extend(getCodeLines(c.rawData))
if args.json:
with open(jsonFolder / Path(name + ".json"), "w") as f:
with open(jsonFolder / Path(name + ".json"), "w", encoding="utf-8") as f:
json.dump(dict([(str(c), c.data) for c in page.components]), f, indent=4)
totalCodeLines = 0
tusloc = set()
for name, text in texts.items():
with open(hmiTextFolder / Path(name + hmiTextFileExt), "w") as f:
with open(hmiTextFolder / Path(name + hmiTextFileExt), "w", encoding="utf-8") as f:
pageCodeLines = codeLines[name]
sloc = len(pageCodeLines)
usloc = set(pageCodeLines)
Expand Down