changeset 4:462179da7dc2

try harder not to write empty links files
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Wed, 19 Feb 2020 10:39:05 +0000
parents 83ed7c5846b2
children a28d731977da
files bin/plinks.py
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/bin/plinks.py	Tue Feb 18 22:19:51 2020 +0000
+++ b/bin/plinks.py	Wed Feb 19 10:39:05 2020 +0000
@@ -13,10 +13,12 @@
     (fno,f)=l.rstrip().split()
     try:
       links=run(f)
-      with open('/dev/shm/x/links_%s'%fno,'w') as of:
-        for k in links.keys():
-          for l in links[k]:
-            print("%s\t%s"%(k,l),file=of)
+      if bool(links) and (links.get('scrape',False) or
+                          links.get('annot',False)):
+        with open('/dev/shm/x/links_%s'%fno,'w') as of:
+          for k in links.keys():
+            for l in links[k]:
+              print("%s\t%s"%(k,l),file=of)
     except Exception as e:
       print("%s\t%s"%(fno,e),file=bf)
     if (path.exists('/dev/shm/stopJob')):