Mercurial > hg > cc > cirrus_work
view bin/plinks.py @ 21:cbac7dfe2f24
interpolate process0, support permanent subproc
| author | Henry S. Thompson <ht@inf.ed.ac.uk> |
|---|---|
| date | Thu, 29 Sep 2022 16:33:42 +0100 |
| parents | 04464ee31d66 |
| children | 38bab758e469 |
line wrap: on
line source
#!/usr/bin/env python3 import sys,pdfx,traceback from datetime import datetime def run(file): global pdf pdf=pdfx.PDFx(file) return pdf.get_references_as_dict() f=sys.argv[1] try: links=run(f) if bool(links) and (links.get('scrape',False) or links.get('annot',False)): for k in links.keys(): for l in links[k]: print("%s\t%s"%(k,l)) except Exception as e: if str(e)=='Unexpected EOF': print("%s:\t%s"%(datetime.now().isoformat(),e),file=sys.stderr) else: print("%s: "%(datetime.now().isoformat()),end='',file=sys.stderr) traceback.print_exc(file=sys.stderr)
