Commit b069b161 authored by Mikaël Salson's avatar Mikaël Salson Committed by Vidjil Team

fuse.py: Don't hardcode temporary files in which we store data.

The current directory is not necessarily writable by the web user.
Use temporary directory instead.
Fix 6cd61c5b
parent 8a2f0470
......@@ -36,6 +36,7 @@ import copy
import os.path
import datetime
import subprocess
import tempfile
from operator import itemgetter
from utils import *
......@@ -728,15 +729,16 @@ def main():
for i in range(len(jlist_fused.d["clones"])) :
fasta += ">>" + str(i) + "\n"
fasta += jlist_fused.d["clones"][i].d["id"] + "\n"
fasta_file = open("tmp", 'w')
fasta_file = tempfile.NamedTemporaryFile()
fasta_file.write(fasta)
try:
out = subprocess.check_output([TOOL_SIMILARITY, "-j", "tmp"])
out = subprocess.check_output([TOOL_SIMILARITY, "-j", fasta_file.name])
jlist_fused.d["similarity"] = json.loads(out)
except OSError:
print("! failed: %s" % TOOL_SIMILARITY)
print("### Save merged file")
jlist_fused.save_json(args.output)
unlink(fasta_file.name)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment