In [1]:
import os, sys
In [2]:
os.getcwd()
Out[2]:
In [3]:
os.listdir('../react-groundstation/')
Out[3]:
In [10]:
os.walk('../react-groundstation/')
for subdir_tuple in next(os.walk('../react-groundstation/')):
print( subdir_tuple )
nodemon.json
- mode, verbose is True and directs to config (**config**
)
package.json
- dependencies, some look like they're from npm
install
In [11]:
import json
from pprint import pprint
In [59]:
import __jsonnet
In [21]:
import re
In [15]:
config_path = '../react-groundstation/config/'
In [12]:
for subdir_tuple in os.walk('../react-groundstation/config/'):
print(subdir_tuple)
In [17]:
file_tempSensorLocations=open(config_path+"tempSensorLocations.js",'r')
#json_raw_tempSensorLocations = json.load(file_tempSensorLocations)
file_tempSensorLocations.close()
rawstr=tempSensorLocations=file_tempSensorLocations.read()
In [ ]:
#rawstr = re.sub(r'\\\n', '', input_str)
#rawstr = re.sub(r'//.*\n', '\n', input_str)
In [57]:
rawstr.replace('\n','').split("=")[1].strip()[:-1].replace(' ','').split("tempSensorLocations") ;
In [53]:
# remove new line, remove first assignment, remove semicolon at end, remove all white space,
# add quotation marks around tempSensorLocations
'"tempSensorLocations"'.join(
rawstr.replace('\n','').split("=")[1].strip()[:-1].replace(' ','').split("tempSensorLocations") );
In [51]:
'{"tempSensorLocations'+rawstr.replace('\n','').split("=")[1].strip()[:-1].replace(' ','').split("tempSensorLocations")[1];
In [52]:
json_tempSensorLocations = json.loads(
'{"tempSensorLocations'+rawstr.replace('\n','').split("=")[1].strip()[:-1].replace(' ','').split("tempSensorLocations")[1] )
In [55]:
rawstr_tempSensorLocations="{'tempSensorLocations':[{'ROMID':'28FF70F7A0160380','Type':'CellTab','Module':'3506'},{'ROMID':'28FF08F4A0160586','Type':'CellTab','Module':'3506'},{'ROMID':'28FF0CA1A016031D','Type':'CellTab','Module':'3506'},{'ROMID':'28FF9CBAA0160306','Type':'CellTab','Module':'3506'},{'ROMID':'28FF5CB8A01604A0','Type':'CellTab','Module':'3506'},{'ROMID':'28FF3C8BA016052F','Type':'PCM','Module':'3506'},{'ROMID':'28FFCA84A01604D1','Type':'PCM','Module':'3506'},{'ROMID':'28FFFA8DA0160598','Type':'CellTab','Module':'3506'},{'ROMID':'28FFC6C8A0160402','Type':'CellTab','Module':'3506'},{'ROMID':'28FF36D9A016054D','Type':'CellTab','Module':'3506'},{'ROMID':'28FFAE7FA01603B9','Type':'CellTab','Module':'3506'},{'ROMID':'28FFEED0A0160363','Type':'CellTab','Module':'3506'},{'ROMID':'28FF3DBCA01603F1','Type':'CellTab','Module':'3506'},{'ROMID':'28FF636B82160419','Type':'PCM','Module':'3506'},{'ROMID':'28FF17A8A016055F','Type':'CellTab','Module':'3506'},{'ROMID':'28FF6087A01604D7','Type':'CellTab','Module':'DBB9'},{'ROMID':'28FF90B8A0160320','Type':'CellTab','Module':'DBB9'},{'ROMID':'28FFF08AA01604FD','Type':'CellTab','Module':'DBB9'},{'ROMID':'28FF78DAA016058E','Type':'PCM','Module':'DBB9'},{'ROMID':'28FFDC66A016047F','Type':'CellTab','Module':'DBB9'},{'ROMID':'28FF899FA0160359','Type':'PCM','Module':'DBB9'},{'ROMID':'28FF39C4A01604D9','Type':'CellTab','Module':'DBB9'},{'ROMID':'28FF959DA0160303','Type':'CellTab','Module':'DBB9'},{'ROMID':'28FF5D84A0160569','Type':'CellTab','Module':'DBB9'},{'ROMID':'28FFE3F4A016052C','Type':'CellTab','Module':'DBB9'},{'ROMID':'28FF33C8A01603F5','Type':'PCM','Module':'DBB9'},{'ROMID':'28FF738BA01605A9','Type':'CellTab','Module':'DBB9'},{'ROMID':'28FFA7BAA01603F2','Type':'CellTab','Module':'DBB9'},{'ROMID':'28FF37D7A0160595','Type':'CellTab','Module':'DBB9'},{'ROMID':'28FFAF67A01604D3','Type':'CellTab','Module':'DBB9'},{'ROMID':'28FF80B9A01603D3','Type':'CellTab','Module':'77EB'},{'ROMID':'28FF90E8A01603F8','Type':'CellTab','Module':'77EB'},{'ROMID':'28FF86BBA01604CB','Type':'PCM','Module':'77EB'},{'ROMID':'28FF7ECAA01603F7','Type':'CellTab','Module':'77EB'},{'ROMID':'28FFB98EA01605B7','Type':'CellTab','Module':'77EB'},{'ROMID':'28FFADA5A01603ED','Type':'CellTab','Module':'77EB'},{'ROMID':'28FFDDE1A01605B3','Type':'CellTab','Module':'77EB'},{'ROMID':'28FF838DA0160506','Type':'CellTab','Module':'77EB'},{'ROMID':'28FFC36BA01604F1','Type':'CellTab','Module':'77EB'},{'ROMID':'28FF4BCBA01604AD','Type':'CellTab','Module':'77EB'},{'ROMID':'28FFAB64A0160444','Type':'CellTab','Module':'77EB'},{'ROMID':'28FF1BC6A01604A5','Type':'CellTab','Module':'77EB'},{'ROMID':'28FF07B9A01604CA','Type':'PCM','Module':'77EB'},{'ROMID':'28FF0F89A01605E2','Type':'CellTab','Module':'77EB'},{'ROMID':'28FFAF8AA0160559','Type':'PCM','Module':'77EB'},{'ROMID':'28FF0087A0160345','Type':'CellTab','Module':'2A3C'},{'ROMID':'28FF48BDA0160442','Type':'CellTab','Module':'2A3C'},{'ROMID':'28FF58BAA01604B8','Type':'PCM','Module':'2A3C'},{'ROMID':'28FF54E6A01603D0','Type':'CellTab','Module':'2A3C'},{'ROMID':'28FFF2D4A01605ED','Type':'CellTab','Module':'2A3C'},{'ROMID':'28FFF6DAA01605E7','Type':'CellTab','Module':'2A3C'},{'ROMID':'28FF6EF5A0160584','Type':'CellTab','Module':'2A3C'},{'ROMID':'28FFF9D6A016059A','Type':'CellTab','Module':'2A3C'},{'ROMID':'28FF05BCA016034B','Type':'PCM','Module':'2A3C'},{'ROMID':'28FF95A8A0160517','Type':'CellTab','Module':'2A3C'},{'ROMID':'28FFC3DFA0160530','Type':'PCM','Module':'2A3C'},{'ROMID':'28FFA3D4A01605B5','Type':'CellTab','Module':'2A3C'},{'ROMID':'28FF93A9A01603D9','Type':'CellTab','Module':'2A3C'},{'ROMID':'28FF3B84A01604BA','Type':'CellTab','Module':'2A3C'},{'ROMID':'28FFCF96A016043C','Type':'CellTab','Module':'2A3C'},{'ROMID':'28FF90FBA0160348','Type':'CellTab','Module':'E357'},{'ROMID':'28FFF490A01604C1','Type':'PCM','Module':'E357'},{'ROMID':'28FF3C85A0160464','Type':'CellTab','Module':'E357'},{'ROMID':'28FF3A96A0160448','Type':'CellTab','Module':'E357'},{'ROMID':'28FFFAB8A016038C','Type':'CellTab','Module':'E357'},{'ROMID':'28FF56F4A01605B1','Type':'PCM','Module':'E357'},{'ROMID':'28FF36DDA0160543','Type':'PCM','Module':'E357'},{'ROMID':'28FF76A1A01603CD','Type':'CellTab','Module':'E357'},{'ROMID':'28FF76F1A01605C8','Type':'CellTab','Module':'E357'},{'ROMID':'28FF76C7A0160354','Type':'CellTab','Module':'E357'},{'ROMID':'28FF7697A016040F','Type':'CellTab','Module':'E357'},{'ROMID':'28FF01F0A016057B','Type':'CellTab','Module':'E357'},{'ROMID':'28FF29B7A0160485','Type':'CellTab','Module':'E357'},{'ROMID':'28FF25BFA01604B8','Type':'CellTab','Module':'E357'},{'ROMID':'28FFCFD7A016050D','Type':'CellTab','Module':'E357'},{'ROMID':'28FF008EA016050B','Type':'CellTab','Module':'0E1C'},{'ROMID':'28FF30F1A01605BD','Type':'CellTab','Module':'0E1C'},{'ROMID':'28FF18B5A01604CB','Type':'CellTab','Module':'0E1C'},{'ROMID':'28FF14BBA01604FF','Type':'CellTab','Module':'0E1C'},{'ROMID':'28FF96BEA01603B5','Type':'CellTab','Module':'0E1C'},{'ROMID':'28FFB6F5A0160339','Type':'CellTab','Module':'0E1C'},{'ROMID':'28FF59D0A016037D','Type':'CellTab','Module':'0E1C'},{'ROMID':'28FFD58BA0160506','Type':'CellTab','Module':'0E1C'},{'ROMID':'28FFFDE6A0160310','Type':'CellTab','Module':'0E1C'},{'ROMID':'28FF13EFA0160526','Type':'PCM','Module':'0E1C'},{'ROMID':'28FF8BE6A01603E1','Type':'CellTab','Module':'0E1C'},{'ROMID':'28FF4BCAA0160422','Type':'CellTab','Module':'0E1C'},{'ROMID':'28FFBB83A01604F7','Type':'PCM','Module':'0E1C'},{'ROMID':'28FF5796A0160336','Type':'PCM','Module':'0E1C'},{'ROMID':'28FFEFA4A0160308','Type':'CellTab','Module':'0E1C'},{'ROMID':'28FF90B9A016042C','Type':'CellTab','Module':'98F6'},{'ROMID':'28FF0486A0160456','Type':'CellTab','Module':'98F6'},{'ROMID':'28FF14DBA0160531','Type':'PCM','Module':'98F6'},{'ROMID':'28FF8C6DA016047E','Type':'CellTab','Module':'98F6'},{'ROMID':'28FF1C85A01605C2','Type':'CellTab','Module':'98F6'},{'ROMID':'28FFDCCBA016044B','Type':'CellTab','Module':'98F6'},{'ROMID':'28FFEEA9A0160585','Type':'CellTab','Module':'98F6'},{'ROMID':'28FF81E1A0160507','Type':'CellTab','Module':'98F6'},{'ROMID':'28FFA1E5A01605F1','Type':'CellTab','Module':'98F6'},{'ROMID':'28FFB993A016044C','Type':'CellTab','Module':'98F6'},{'ROMID':'28FF75B6A01604BE','Type':'CellTab','Module':'98F6'},{'ROMID':'28FF3DC8A01604D4','Type':'PCM','Module':'98F6'},{'ROMID':'28FF4365A016042F','Type':'PCM','Module':'98F6'},{'ROMID':'28FF67AEA01603E6','Type':'CellTab','Module':'98F6'},{'ROMID':'28FF17B6A016042C','Type':'CellTab','Module':'98F6'},{'ROMID':'28FFD085A016049F','Type':'CellTab','Module':'15FD'},{'ROMID':'28FFF09FA01603C7','Type':'CellTab','Module':'15FD'},{'ROMID':'28FFCCB6A0160402','Type':'PCM','Module':'15FD'},{'ROMID':'28FF1C82A0160544','Type':'CellTab','Module':'15FD'},{'ROMID':'28FF6689A0160500','Type':'CellTab','Module':'15FD'},{'ROMID':'28FFE6C6A01604EF','Type':'CellTab','Module':'15FD'},{'ROMID':'28FF61F0A016056A','Type':'PCM','Module':'15FD'},{'ROMID':'28FFB1CBA01604B6','Type':'CellTab','Module':'15FD'},{'ROMID':'28FF19A9A0160572','Type':'CellTab','Module':'15FD'},{'ROMID':'28FFD595A0160475','Type':'CellTab','Module':'15FD'},{'ROMID':'28FF43A2A0160313','Type':'CellTab','Module':'15FD'},{'ROMID':'28FF07C4A01604FF','Type':'PCM','Module':'15FD'},{'ROMID':'28FF97BCA01604FC','Type':'CellTab','Module':'15FD'},{'ROMID':'28FF2FE7A0160342','Type':'CellTab','Module':'15FD'},{'ROMID':'28FF6FE3A0160578','Type':'CellTab','Module':'15FD'},{'ROMID':'28FF087DA0160492','Type':'CellTab','Module':'C838'},{'ROMID':'28FFE874A0160358','Type':'CellTab','Module':'C838'},{'ROMID':'28FFE4DCA0160511','Type':'CellTab','Module':'C838'},{'ROMID':'28FF5C6AA01604A6','Type':'CellTab','Module':'C838'},{'ROMID':'28FF12BAA016036F','Type':'CellTab','Module':'C838'},{'ROMID':'28FFAA8BA0160504','Type':'CellTab','Module':'C838'},{'ROMID':'28FFAAF7A0160363','Type':'CellTab','Module':'C838'},{'ROMID':'28FFD1EFA0160587','Type':'PCM','Module':'C838'},{'ROMID':'28FF658DA0160540','Type':'CellTab','Module':'C838'},{'ROMID':'28FFC369A01604F6','Type':'PCM','Module':'C838'},{'ROMID':'28FFABF1A01603A7','Type':'CellTab','Module':'C838'},{'ROMID':'28FF47B6A01604B9','Type':'CellTab','Module':'C838'},{'ROMID':'28FFB7F1A0160527','Type':'CellTab','Module':'C838'},{'ROMID':'28FF8FF4A016051C','Type':'CellTab','Module':'C838'},{'ROMID':'28FF4FBCA016031F','Type':'PCM','Module':'C838'},{'ROMID':'28FFB0E5A0160540','Type':'CellTab','Module':'F2D2'},{'ROMID':'28FF98A0A016033A','Type':'CellTab','Module':'F2D2'},{'ROMID':'28FF428DA01605E9','Type':'PCM','Module':'F2D2'},{'ROMID':'28FF62A2A0160326','Type':'CellTab','Module':'F2D2'},{'ROMID':'28FF6AE8A01603E3','Type':'CellTab','Module':'F2D2'},{'ROMID':'28FFD693A01603B1','Type':'CellTab','Module':'F2D2'},{'ROMID':'28FFF689A01605B7','Type':'CellTab','Module':'F2D2'},{'ROMID':'28FFB967A0160433','Type':'PCM','Module':'F2D2'},{'ROMID':'28FFC3BDA016037A','Type':'CellTab','Module':'F2D2'},{'ROMID':'28FFD36BA016048D','Type':'PCM','Module':'F2D2'},{'ROMID':'28FF8B89A01603EB','Type':'CellTab','Module':'F2D2'},{'ROMID':'28FF2B87A0160510','Type':'CellTab','Module':'F2D2'},{'ROMID':'28FFD7CCA016033E','Type':'CellTab','Module':'F2D2'},{'ROMID':'28FF7787A01604FA','Type':'CellTab','Module':'F2D2'},{'ROMID':'28FF2F93A0160467','Type':'CellTab','Module':'F2D2'},{'ROMID':'28FF4067A0160466','Type':'CellTab','Module':'7D27'},{'ROMID':'28FF609DA0160377','Type':'CellTab','Module':'7D27'},{'ROMID':'28FF54DCA016055E','Type':'CellTab','Module':'7D27'},{'ROMID':'28FF4CBAA0160358','Type':'CellTab','Module':'7D27'},{'ROMID':'28FF5CF1A016058D','Type':'CellTab','Module':'7D27'},{'ROMID':'28FFC29BA01603CE','Type':'CellTab','Module':'7D27'},{'ROMID':'28FF22E5A0160574','Type':'CellTab','Module':'7D27'},{'ROMID':'28FF86DCA0160583','Type':'CellTab','Module':'7D27'},{'ROMID':'28FF6694A01604FB','Type':'PCM','Module':'7D27'},{'ROMID':'28FF9EB7A016049B','Type':'CellTab','Module':'7D27'},{'ROMID':'28FFA987A0160406','Type':'CellTab','Module':'7D27'},{'ROMID':'28FFDDCBA0160486','Type':'CellTab','Module':'7D27'},{'ROMID':'28FF13CCA0160480','Type':'PCM','Module':'7D27'},{'ROMID':'28FFE7B4A016048D','Type':'CellTab','Module':'7D27'},{'ROMID':'28FF0FCFA016050B','Type':'PCM','Module':'7D27'},{'ROMID':'28FFC0F4A016059A','Type':'CellTab','Module':'A58A'},{'ROMID':'28FF0CB6A0160420','Type':'CellTab','Module':'A58A'},{'ROMID':'28FF2C7DA0160475','Type':'PCM','Module':'A58A'},{'ROMID':'28FF4AB8A01603C3','Type':'CellTab','Module':'A58A'},{'ROMID':'28FF3E9EA01603C8','Type':'CellTab','Module':'A58A'},{'ROMID':'28FF698CA01604B0','Type':'PCM','Module':'A58A'},{'ROMID':'28FF59B6A0160467','Type':'CellTab','Module':'A58A'},{'ROMID':'28FF39F0A01605C1','Type':'CellTab','Module':'A58A'},{'ROMID':'28FFD5E7A0160359','Type':'CellTab','Module':'A58A'},{'ROMID':'28FFF583A01604BC','Type':'CellTab','Module':'A58A'},{'ROMID':'28FF83D1A0160311','Type':'PCM','Module':'A58A'},{'ROMID':'28FF6BF8A0160316','Type':'CellTab','Module':'A58A'},{'ROMID':'28FF278BA0160523','Type':'CellTab','Module':'A58A'},{'ROMID':'28FFB7DEA0160310','Type':'CellTab','Module':'A58A'},{'ROMID':'28FFAF89A016048F','Type':'CellTab','Module':'A58A'},{'ROMID':'28FF80D1A016035F','Type':'CellTab','Module':'AC2C'},{'ROMID':'28FF1493A0160493','Type':'CellTab','Module':'AC2C'},{'ROMID':'28FF42F2A01605DB','Type':'CellTab','Module':'AC2C'},{'ROMID':'28FF328BA016058D','Type':'CellTab','Module':'AC2C'},{'ROMID':'28FF72CAA0160455','Type':'CellTab','Module':'AC2C'},{'ROMID':'28FFDAF6A0160381','Type':'PCM','Module':'AC2C'},{'ROMID':'28FF56E0A016035A','Type':'CellTab','Module':'AC2C'},{'ROMID':'28FF36E7A01603CD','Type':'CellTab','Module':'AC2C'},{'ROMID':'28FFAEC4A016043F','Type':'PCM','Module':'AC2C'},{'ROMID':'28FF41DBA0160576','Type':'CellTab','Module':'AC2C'},{'ROMID':'28FF996EA0160458','Type':'CellTab','Module':'AC2C'},{'ROMID':'28FF0DF0A016055A','Type':'CellTab','Module':'AC2C'},{'ROMID':'28FFDBE1A016052F','Type':'PCM','Module':'AC2C'},{'ROMID':'28FF8FA3A016039F','Type':'CellTab','Module':'AC2C'},{'ROMID':'28FF6F64A0160479','Type':'CellTab','Module':'AC2C'},{'ROMID':'28FF20B8A01604EC','Type':'CellTab','Module':'2072'},{'ROMID':'28FFB08CA0160543','Type':'CellTab','Module':'2072'},{'ROMID':'28FF18C0A01604E2','Type':'CellTab','Module':'2072'},{'ROMID':'28FF14E7A01603B6','Type':'PCM','Module':'2072'},{'ROMID':'28FF228BA01605F1','Type':'CellTab','Module':'2072'},{'ROMID':'28FFAE65A0160419','Type':'CellTab','Module':'2072'},{'ROMID':'28FF89E2A01605B1','Type':'CellTab','Module':'2072'},{'ROMID':'28FFE995A0160353','Type':'CellTab','Module':'2072'},{'ROMID':'28FF196AA016049D','Type':'PCM','Module':'2072'},{'ROMID':'28FFD5D2A016054D','Type':'CellTab','Module':'2072'},{'ROMID':'28FFCB64A0160455','Type':'CellTab','Module':'2072'},{'ROMID':'28FF9BDBA0160595','Type':'PCM','Module':'2072'},{'ROMID':'28FF07E1A0160550','Type':'CellTab','Module':'2072'},{'ROMID':'28FFA797A016031F','Type':'CellTab','Module':'2072'},{'ROMID':'28FFBFCBA0160414','Type':'CellTab','Module':'2072'},{'ROMID':'28FF90C8A0160388','Type':'CellTab','Module':'24AF'},{'ROMID':'28FF08BEA0160423','Type':'CellTab','Module':'24AF'},{'ROMID':'28FF42CEA016035C','Type':'CellTab','Module':'24AF'},{'ROMID':'28FF8AF8A0160301','Type':'CellTab','Module':'24AF'},{'ROMID':'28FFE6CAA016037E','Type':'CellTab','Module':'24AF'},{'ROMID':'28FFCE88A01604DC','Type':'PCM','Module':'24AF'},{'ROMID':'28FF51B8A01603CF','Type':'CellTab','Module':'24AF'},{'ROMID':'28FF6994A0160494','Type':'CellTab','Module':'24AF'},{'ROMID':'28FFF9F0A01605E3','Type':'CellTab','Module':'24AF'},{'ROMID':'28FFBD9CA01604C9','Type':'CellTab','Module':'24AF'},{'ROMID':'28FFE365A016041C','Type':'PCM','Module':'24AF'},{'ROMID':'28FF8BEBA016037C','Type':'CellTab','Module':'24AF'},{'ROMID':'28FF6B8EA016056A','Type':'CellTab','Module':'24AF'},{'ROMID':'28FFFBDAA016050B','Type':'PCM','Module':'24AF'},{'ROMID':'28FFFB8BA016055C','Type':'CellTab','Module':'24AF'},{'ROMID':'28FF187EA0160466','Type':'PCM','Module':'9D01'},{'ROMID':'28FFCCB8A0160417','Type':'CellTab','Module':'9D01'},{'ROMID':'28FF2A95A016033F','Type':'CellTab','Module':'9D01'},{'ROMID':'28FF21ACA0160394','Type':'CellTab','Module':'9D01'},{'ROMID':'28FFD1D2A0160552','Type':'CellTab','Module':'9D01'},{'ROMID':'28FFA9D8A016051A','Type':'CellTab','Module':'9D01'},{'ROMID':'28FFB9BBA01603A3','Type':'CellTab','Module':'9D01'},{'ROMID':'28FF7987A0160458','Type':'PCM','Module':'9D01'},{'ROMID':'28FF3D64A016046F','Type':'CellTab','Module':'9D01'},{'ROMID':'28FF63F5A0160568','Type':'CellTab','Module':'9D01'},{'ROMID':'28FF1BBAA016039C','Type':'CellTab','Module':'9D01'},{'ROMID':'28FF8796A01604EB','Type':'CellTab','Module':'9D01'},{'ROMID':'28FFA7E1A0160563','Type':'CellTab','Module':'9D01'},{'ROMID':'28FFCFE5A0160542','Type':'PCM','Module':'9D01'},{'ROMID':'28FF9F88A01605DA','Type':'CellTab','Module':'9D01'},{'ROMID':'28FFF8DFA01605C4','Type':'CellTab','Module':'DC45'},{'ROMID':'28FF9C97A0160468','Type':'CellTab','Module':'DC45'},{'ROMID':'28FF2284A016056B','Type':'CellTab','Module':'DC45'},{'ROMID':'28FFB6D7A0160593','Type':'PCM','Module':'DC45'},{'ROMID':'28FF5EB3A01604B7','Type':'CellTab','Module':'DC45'},{'ROMID':'28FFA1E4A016057E','Type':'CellTab','Module':'DC45'},{'ROMID':'28FFC5C9A01604C3','Type':'CellTab','Module':'DC45'},{'ROMID':'28FF55DDA016051C','Type':'CellTab','Module':'DC45'},{'ROMID':'28FFADB8A0160348','Type':'CellTab','Module':'DC45'},{'ROMID':'28FF8B93A016044B','Type':'PCM','Module':'DC45'},{'ROMID':'28FF8B73A0160402','Type':'PCM','Module':'DC45'},{'ROMID':'28FFE784A01604C5','Type':'CellTab','Module':'DC45'},{'ROMID':'28FFF7A4A016034A','Type':'CellTab','Module':'DC45'},{'ROMID':'28FFDF8AA0160534','Type':'CellTab','Module':'DC45'},{'ROMID':'28FFBF87A01604E6','Type':'CellTab','Module':'DC45'}]}"
In [56]:
json_tempSensorLocations = json.loads( rawstr_tempSensorLocations)
Try manually editing the file itself and then feeding it in. Delete JavaScript Object/Variable name, assignment operator (i.e. '=' sign), put quotes around the first attribute, and delete semicolons).
In [72]:
file_tempSensorLocations=open(config_path+"tempSensorLocations.json",'r')
#json_raw_tempSensorLocations = json.load(file_tempSensorLocations)
rawstr_tempSensorLocations=file_tempSensorLocations.read()
file_tempSensorLocations.close()
In [69]:
rawstr_tempSensorLocations.replace('\n','').replace(' ','')
Out[69]:
"Sometimes you can have this error because your string values are not well recognized by python. As an example: I've spent quite a lot of time searching for the origin of this kind of error. Here is what I found.
Sometimes a language recognizes a kind of quotes and not another one: btw, to parse a string in to json in JavaScript all quotes have to be in the ' format
to parse a string into json in JavaScript all quotes have to be in the " format which is not really logic.
Hopefully you can use the replace function. For Python:
json.loads(s.replace("\'", '"'));
Hope it will save you the time I've spent hunting this bug!"
edited Feb 10 '16 at 20:12 Rickest Rick
answered Dec 9 '13 at 15:06 gronaz
In [75]:
#json_tempSensorLocations = json.loads( rawstr_tempSensorLocations.replace('\n','').replace(' ',''))
json_tempSensorLocations = json.loads( rawstr_tempSensorLocations.replace("\'", '"') )
In [77]:
json_tempSensorLocations.keys()
Out[77]:
In [79]:
print(len(json_tempSensorLocations['tempSensorLocations']))
json_tempSensorLocations['tempSensorLocations'][0].keys()
Out[79]:
In [81]:
os.listdir('../react-groundstation/logs/')
Out[81]:
In [83]:
#for subdir_tuple in next(os.walk('../react-groundstation/node_modules/')):
# print( subdir_tuple )
os.listdir("../react-groundstation/node_modules/")
Out[83]:
In [ ]: