aboutsummaryrefslogtreecommitdiff
path: root/wqflask/utility
diff options
context:
space:
mode:
authorPjotr Prins2016-10-07 07:05:22 +0000
committerPjotr Prins2016-10-07 07:05:22 +0000
commit9e4c8f01e1a0aa49d218f7909ed5b7979ffc6fb9 (patch)
tree7033440d3325b180c692a692d22d7afee4c6c47a /wqflask/utility
parent28da8f4304f406b4eff5ad68757735a0cb524e94 (diff)
downloadgenenetwork2-9e4c8f01e1a0aa49d218f7909ed5b7979ffc6fb9.tar.gz
Saner handling of TMPDIR and TEMPDIR
Throw error when TMPDIRs are not writable
Diffstat (limited to 'wqflask/utility')
-rw-r--r--wqflask/utility/tools.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/wqflask/utility/tools.py b/wqflask/utility/tools.py
index 23d6fb62..5105ba42 100644
--- a/wqflask/utility/tools.py
+++ b/wqflask/utility/tools.py
@@ -113,6 +113,16 @@ def assert_dir(dir):
raise Exception("ERROR: can not find directory "+dir)
return dir
+def assert_writable_dir(dir):
+ try:
+ fn = dir + "/test.txt"
+ fh = open( fn, 'w' )
+ fh.write("I am writing this text to the file\n")
+ fh.close()
+ os.remove(fn)
+ except IOError:
+ raise Exception('Unable to write to directory ' + dir )
+ return dir
def mk_dir(dir):
if not valid_path(dir):
@@ -205,7 +215,7 @@ GENENETWORK_FILES = get_setting('GENENETWORK_FILES')
PYLMM_COMMAND = pylmm_command()
GEMMA_COMMAND = gemma_command()
PLINK_COMMAND = plink_command()
-TEMPDIR = tempdir()
+TEMPDIR = tempdir() # defaults to UNIX TMPDIR
from six import string_types