Logo Search packages:      
Sourcecode: yagtd version File versions  Download package

def yagtd::GTD::do_load (   self,
  todotxt 
)
Load from a todotxt file:
GTD> load path/to/todo.txt

Definition at line 874 of file yagtd.py.

                              :
        """Load from a todotxt file:
        GTD> load path/to/todo.txt"""

        try:
            f = open(todotxt, 'r')
            try:
                self.todo.erase()  # clean
                nb = 0
                for line in f:
                    #print line,
                    if line.lstrip().startswith('#'): continue
                    self._add(line.strip())
                    nb += 1
            finally:
                f.close()
                self.todotxt = todotxt  # ok, save file path
                print "%d tasks loaded from '%s'" % (nb, todotxt)
        except IOError, err:
            # 'file not found' exception?
            if err.errno != errno.ENOENT: raise  # raise all others
            print err  # and continue


Generated by  Doxygen 1.6.0   Back to index