diff --git a/server/src/annotation.py b/server/src/annotation.py index a11e0fe1b..ed5c4b42d 100755 --- a/server/src/annotation.py +++ b/server/src/annotation.py @@ -17,7 +17,7 @@ from codecs import open as codecs_open from functools import partial from itertools import chain, takewhile -from os import utime +from os import close as os_close, utime from time import time from os.path import join as path_join from os.path import basename, splitext @@ -964,7 +964,8 @@ def __exit__(self, type, value, traceback): # so we hack around it. #with NamedTemporaryFile('w', suffix='.ann') as tmp_file: # Grab the filename, but discard the handle - _, tmp_fname = mkstemp(suffix='.ann') + tmp_fh, tmp_fname = mkstemp(suffix='.ann') + os_close(tmp_fh) try: with open_textfile(tmp_fname, 'w') as tmp_file: #XXX: Temporary hack to make sure we don't write corrupted diff --git a/server/src/download.py b/server/src/download.py index a846dd9e3..64ee0f0c8 100644 --- a/server/src/download.py +++ b/server/src/download.py @@ -7,7 +7,7 @@ from __future__ import with_statement -from os import remove +from os import close as os_close, remove from os.path import join as path_join, dirname, basename from tempfile import mkstemp @@ -42,7 +42,9 @@ def download_collection(collection, exclude_configs=False): tmp_file_path = None try: - _, tmp_file_path = mkstemp() + tmp_file_fh, tmp_file_path = mkstemp() + os_close(tmp_file_fh) + tar_cmd_split = ['tar', '--exclude=.stats_cache'] if exclude_configs: tar_cmd_split.extend(['--exclude=annotation.conf', diff --git a/server/src/session.py b/server/src/session.py index c5f92d5ed..12da5835e 100755 --- a/server/src/session.py +++ b/server/src/session.py @@ -231,7 +231,8 @@ def load_conf(): init_session('127.0.0.1') tmp_file_path = None try: - _, tmp_file_path = mkstemp() + tmp_file_fh, tmp_file_path = mkstemp() + os_close(tmp_file_fh) session = get_session() session['foo'] = 'bar' with open(tmp_file_path, 'wb') as tmp_file: