forked from fuzzysteve/yamlloader
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexportTypesToJson.py
More file actions
33 lines (27 loc) · 875 Bytes
/
exportTypesToJson.py
File metadata and controls
33 lines (27 loc) · 875 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
from yaml import load
import json
import os
import ConfigParser
try:
from yaml import CSafeLoader as SafeLoader
print("Using CSafeLoader")
except ImportError:
from yaml import SafeLoader
print("Using Python SafeLoader")
fileLocation = os.path.dirname(os.path.realpath(__file__))
inifile=fileLocation+'/config.cfg'
config = ConfigParser.ConfigParser()
config.read(inifile)
sourcePath=config.get('Files','sourcePath')
destinationPath=config.get('Files','destinationPath')
print("opening Yaml")
with open(os.path.join(sourcePath,'fsd','typeIDs.yaml'),'r') as yamlstream:
print("importing")
typeids=load(yamlstream,Loader=SafeLoader)
print("Yaml Processed into memory")
with open(os.path.join(destinationPath,'typeid.json'),"w") as output:
json.dump(typeids,output)