changeset 24:2ab40f9266e4 draft

An update to the core of galaxy prevents the way the code is trying to write files. This patch fixes this.
author linda-bakker
date Tue, 20 Feb 2018 07:59:47 -0500
parents bee03dc123f2
children 9f03c8587d6b
files rankfilter_GCMS/nistpdf_to_tabular.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/rankfilter_GCMS/nistpdf_to_tabular.py	Tue Feb 20 07:29:49 2018 -0500
+++ b/rankfilter_GCMS/nistpdf_to_tabular.py	Tue Feb 20 07:59:47 2018 -0500
@@ -15,8 +15,9 @@
 
 """
 
-import sys
+import sys,os
 import pdfread
+import tempfile
 from subprocess import call
 
 # NB: THIS TOOL SHOULD BE DEPRECATED ONCE NIST-Wrapper tool is stable and released. NIST-Wrapper tool already produces the necessary tabular file.
@@ -40,6 +41,8 @@
 
 
 if __name__ == '__main__':
-    pdf_as_text = sys.argv[1]+".txt"
+    #pdf_as_text = sys.argv[1]+".txt"
+    pdf_as_text = tempfile.mkstemp()[1]
     convert_pdftotext(sys.argv[1], pdf_as_text)
     pdfread.convert_pdftotext2tabular(pdf_as_text, sys.argv[2], sys.argv[3], False)
+    os.remove(pdf_as_text)