Open 'except' causes strange bugs

  • Stewart Midwinter

    While hacking together a Save as Copy menu method, I noticed that the code has lots of open or unspecified 'except' statements.  My experience has been that when I use a try ... except statement, I need to follow the 'except' with the type of error I am expecting to trap..  Otherwise, it's possible that the exception will be handled by another 'except' statement elsewhere in the app, which makes it *really* hard to pin down. Ask me how I know this!

    So, for file operations, like Save As Copy, I used 'except IOError'; if I were converting a string to int, I might use 'except TypeError', and so on.


        shutil.copyfile(self.txtDocument.filename, cfilename)
    except IOError:


    • Daniel Pozmanter

      Was this resolved?
      Your code worked fine for me.
      (Although PLEASE email it, or attach it to patches on the main project page)

      Very useful feature to add.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks