示例#1
0
def getDBDict(cmd):
    ret = execCommand(cmd)
    retstr = ret.decode('utf-8')
    if isWin():
        retstr = retstr.translate(str.maketrans({"\\": r"\\"}))
    ret = json.loads(retstr)
    if ret['Status'] != 'OK':
        log_msg(ret['Status'])
        raise FileNotFoundError
    return ret
示例#2
0
def retFileLoc(bstdout):
    if bstdout == None:
        return None
    retstr = bstdout.decode('utf-8')
    if isWin():
        retstr = retstr.translate(str.maketrans({"\\": r"\\"}))
    fileloc = json.loads(retstr)
    if fileloc['Status'] != 'OK':
        log_msg(fileloc['Status'])
        raise FileNotFoundError
    return fileloc['File_name']
示例#3
0
def retFileLoc( bstdout ):
  if bstdout == None:
    return None
  retstr = bstdout.decode('utf-8')
  if isWin():
    retstr = retstr.translate(str.maketrans({"\\": r"\\"}))
  fileloc = json.loads( retstr )
  if fileloc['Status'] != 'OK':
    log_msg( fileloc['Status'] )
    raise FileNotFoundError
  return fileloc['data']['File_name']
示例#4
0
def getDBList(translnm,args=None):
  cmd = getODCommand(dbmanexe,args)
  cmd.append( '--json' )
  cmd.append( '--list' )
  cmd.append( translnm )
  ret = execCommand( cmd )
  retstr = ret.decode('utf-8')
  if isWin():
    retstr = retstr.translate(str.maketrans({"\\": r"\\"}))
  db = json.loads( retstr )
  if db['Status'] != 'OK':
    log_msg( db['Status'] )
    raise FileNotFoundError
  return db['data']
示例#5
0
def getDBList(translnm, args=None):
    cmd = getODCommand(dbmanexe, args)
    cmd.append('--json')
    cmd.append('--list')
    cmd.append(translnm)
    ret = execCommand(cmd)
    retstr = ret.decode('utf-8')
    if isWin():
        retstr = retstr.translate(str.maketrans({"\\": r"\\"}))
    ret = json.loads(retstr)
    if ret['Status'] != 'OK':
        log_msg(ret['Status'])
        raise FileNotFoundError
    return ret
示例#6
0
def log_subprocess_output(pipe):
    for line in iter(pipe.readline, b''):
        log_msg(line.decode('utf-8').strip('\n'))