def test(): #fileName = "fejoz" #fileName = "minimal" #fileName = 'simple' import LogService LogService.setLogStdOut('%(message)s') import sys fileName = sys.argv[1] hf = hrlib.open("%s.hr5" % fileName) output = file("%s_output.hr5" % fileName,'wb') save(hf,output) output.close() hf.close() hf = hrlib.open("%s_output.hr5" % fileName) hf.close()
def translate(heredisFileName=None, options=None, translator=hr2gedStandard.hr2gedStandard, openedFile=None): if (not heredisFileName) and (not openedFile): return if not options: options = hr2gedOption() depart = time.time() if heredisFileName: if options.filename: gedcomFileName = options.filename else: gedcomFileName = heredisFileName[:-4]+'.ged' #gf = file(gedcomFileName,'w') gf = codecs.open(gedcomFileName, "w", translator.charCode,'replace') else: gedcomFileName = "stdout" gf = None hf = hrlib.open(fileName=heredisFileName, openedFile=openedFile) h2g = translator() logger.info("operation en cours...") try: h2g.heredis2gedcom(hf,gf,options.mediaDir,options.indent,options.noteType,options.charCode,options.private, not options.keepgoing) finally: hf.close() if gf: gf.close() fin = time.time() logger.info("resultat dans %s",gedcomFileName) logger.info("done in %d seconds",(fin-depart)) del h2g return gedcomFileName
def doHr2WhatEver(f): hf = hrlib.open(openedFile=f) for indi in hf.individuGenerator(): output.write(indi.name) output.write(u"<br />\n")