Merged with trunk
[hooke.git] / hooke / hooke_cli.py
index 886563b735a8328119f15a9c3583a446c1465370..b36b65a4386aec26f8035d7beda5897d8a130cf0 100644 (file)
@@ -1,4 +1,5 @@
 #!/usr/bin/env python
+# -*- coding: utf-8 -*-
 
 '''
 hooke_cli.py
@@ -288,11 +289,11 @@ Syntax: genlist [input files]
             else:
                 SLASH="/"
             if list_path[-1] == SLASH:
-                list_path=list_path+'*.*'
-            else:
-                list_path=list_path+SLASH+'*.*'
-
-        #expanding correctly the input list with the glob module :)
+                list_path=list_path+'*'
+            else:    
+                list_path=list_path+SLASH+'*'
+        
+        #expanding correctly the input list with the glob module :)        
         list_files=glob.glob(list_path)
         list_files.sort()
 
@@ -674,7 +675,13 @@ Syntax: txt [filename] {plot to export}
             except:
                 pass
 
-        columns=[]
+       try:
+            outofplot=self.plots[whichplot].vectors
+        except:
+            print "Plot index out of range."
+           return 0
+
+        columns=[]     
         for dataset in self.plots[whichplot].vectors:
             for i in range(0,len(dataset)):
                 columns.append([])
@@ -738,9 +745,12 @@ Syntax: txt [filename] {plot to export}
             print self.current_list[self.pointer].notes
         else:
             if self.notes_filename == None:
+               if not os.path.exists(os.path.realpath('output')):
+                   os.mkdir('output')
                 self.notes_filename=raw_input('Notebook filename? ')
+               self.notes_filename=os.path.join(os.path.realpath('output'),self.notes_filename)
                 title_line='Notes taken at '+time.asctime()+'\n'
-                f=open(self.notes_filename,'w')
+                f=open(self.notes_filename,'a')
                 f.write(title_line)
                 f.close()