-
Notifications
You must be signed in to change notification settings - Fork 17
/
TypesToJson.py
34 lines (27 loc) · 868 Bytes
/
TypesToJson.py
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
34
# -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
import yaml
import json
import os
try:
from yaml import CSafeLoader as SafeLoader
print "Using CSafeLoader"
except ImportError:
from yaml import SafeLoader
print "Using Python SafeLoader"
import ConfigParser, os
fileLocation = os.path.dirname(os.path.realpath(__file__))
inifile=fileLocation+'/sdeloader.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)