mirror of
https://github.com/mewtek/i2ME-Legacy.git
synced 2025-05-16 19:10:25 -05:00
Error if XML is missing
This commit is contained in:
parent
e65b66f73a
commit
1ae86e2898
@ -1,12 +1,17 @@
|
|||||||
import json
|
import json
|
||||||
|
import sys
|
||||||
import xmltodict
|
import xmltodict
|
||||||
|
|
||||||
|
|
||||||
# Open the MachineProductCfg.xml file in the root directory
|
# Open the MachineProductCfg.xml file in the root directory
|
||||||
with open("MachineProductCfg.xml", mode = 'r', encoding= 'utf-8') as MPCxml:
|
try:
|
||||||
|
with open("MachineProductCfg.xml", mode = 'r', encoding= 'utf-8') as MPCxml:
|
||||||
MPCdict = xmltodict.parse(MPCxml.read())
|
MPCdict = xmltodict.parse(MPCxml.read())
|
||||||
MPCdump = json.dumps(MPCdict)
|
MPCdump = json.dumps(MPCdict)
|
||||||
data = json.loads(MPCdump)
|
data = json.loads(MPCdump)
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
sys.exit("There was an error opening your MachineProductCfg.xml. Is the file in the root folder?")
|
||||||
|
|
||||||
|
|
||||||
def getPrimaryLocations():
|
def getPrimaryLocations():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user