wp.connect() elif ou_f == 'LyX': from Pyblio.Cite.WP.LyX import LyX wp = LyX() wp.connect() else: # Connect to a file from Pyblio.Cite.WP.File import File import codecs output = codecs.open(ou_f, 'w', encoding='utf-8') wp = File(output) # We can now connect our database to the document in which we will # cite the records. citator.prepare(db, wp) # "cite" the references in our document, arbitrarily using the # chronological order. view = db.entries.view(Sort.OrderBy('date', asc=False)) for k in view.iterkeys(): citator.cite([k]) # ...and ask for an update of the bibliography, which will actually # write the file. citator.update()