comparison bin/plinks.py @ 3:cbd13beb0922

only create links file if there are some
author Henry Thompson <ht@markup.co.uk>
date Tue, 18 Feb 2020 22:41:08 +0000
parents 83ed7c5846b2
children a28d731977da
comparison
equal deleted inserted replaced
2:83ed7c5846b2 3:cbd13beb0922
11 with open('/dev/shm/x/badpdfs_%s'%me,'w') as bf: 11 with open('/dev/shm/x/badpdfs_%s'%me,'w') as bf:
12 for l in sys.stdin: 12 for l in sys.stdin:
13 (fno,f)=l.rstrip().split() 13 (fno,f)=l.rstrip().split()
14 try: 14 try:
15 links=run(f) 15 links=run(f)
16 with open('/dev/shm/x/links_%s'%fno,'w') as of: 16 if links:
17 for k in links.keys(): 17 with open('/dev/shm/x/links_%s'%fno,'w') as of:
18 for l in links[k]: 18 for k in links.keys():
19 print("%s\t%s"%(k,l),file=of) 19 for l in links[k]:
20 print("%s\t%s"%(k,l),file=of)
20 except Exception as e: 21 except Exception as e:
21 print("%s\t%s"%(fno,e),file=bf) 22 print("%s\t%s"%(fno,e),file=bf)
22 if (path.exists('/dev/shm/stopJob')): 23 if (path.exists('/dev/shm/stopJob')):
23 print("Quiting early: %s %s"%(me,fno),file=sys.stderr) 24 print("Quiting early: %s %s"%(me,fno),file=sys.stderr)
24 exit(1) 25 exit(1)