Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
    try :
        plf = PeakListFile(fname)
    except Exception as e:
        print 'We cought exception: %s' % e

User defined exception

Code Block
class MyError(Exception):
    def __init__(self, value):
        self.value = value
    def __str__(self):
        return repr(self.value)
...
try:
    raise MyError(2*2)
except MyError as e:
    print 'My exception occurred, value:', e.value

 

Manipulation with directories and files

...