changeset 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
files bin/plinks.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/bin/plinks.py	Tue Feb 18 22:19:51 2020 +0000
+++ b/bin/plinks.py	Tue Feb 18 22:41:08 2020 +0000
@@ -13,10 +13,11 @@
     (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 links:
+        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')):