Add os.path.expanduser() wrappers to user-supplied paths.
[hooke.git] / hooke / plugin / cut.py
index 5d7d79c0e7eae4d7d30b5716c399aa75736b32c1..6aef07695bd38ea16ee8444c95d387a29c2f5e1c 100644 (file)
@@ -22,6 +22,8 @@
 :class:`CutCommand`.
 """
 
+import os.path
+
 import numpy
 
 from ..command import Command, Argument, Failure
@@ -97,7 +99,7 @@ True if you want the column-naming header line.
         cut_data = data[i_min:i_max+1,:] # slice rows from row-major data
         # +1 to include data[i_max] row
 
-        f = open(params['output'], 'w')
+        f = open(os.path.expanduser(params['output']), 'w')
         if params['header'] == True:
             f.write('# %s \n' % ('\t'.join(cut_data.info['columns'])))
         numpy.savetxt(f, cut_data, delimiter='\t')