I Need A Placeholder

Ampedesign metalkeys404 at gmail.com
Thu Jun 26 19:12:01 CEST 2008

On Jun 26, 10:08 am, Duncan Booth <duncan.bo... at invalid.invalid>
> Ampedesign <metalkeys... at gmail.com> wrote:
> > I'm trying to build a try/except case, and I want to have the except
> > function like such:
> > try:
> >       # Do some code here
> >       var = 1         # For example
> > except:
> >       #Do nothing here
> > The only problem is if I leave a comment only in the except block, I
> > get an error back saying that the except block is not properly
> > formatted, since it has no content other than a comment.
> > So if anyone could suggest some code to put there as a placeholder
> > that would be wonderful.
> Use the 'pass' statement.
> But really, you should not have a bare except: if you are going to ignore a
> specific exception that's fine, but don't ignore all exceptions. You'll
> regret it.

This is true. Though I get a wide range of exceptions since I'm
downloading and parsing a file. I will get everything from a socket
error to an empty xml element.

In the future however, I will make separate exceptions.

More information about the Python-list mailing list