Brant,
Nope...did the same thing.

On May 19, 2:00 pm, "Brant Fitzsimmons" <[EMAIL PROTECTED]>
wrote:
> You may want to try 'continue' instead of 'pass'.
>
>
>
> On Mon, May 19, 2008 at 2:48 PM, Greg <[EMAIL PROTECTED]> wrote:
>
> > Hello,
> > I have the following code:
>
> > ///
>
> > import csv
> > from myproject.site.models import OrderEmail
>
> > reader = csv.reader(open("myfile.csv", "rb"))
> > for row in reader:
> >    try:
> >        b = OrderEmail(name=row[0], email=row[1], been_sent="0")
> >        b.save()
> >    except:
> >        pass
> > assert False, "End"
>
> > Whenever I run across the first problem record...my for loop stops and
> > 'End' is printed.  I thought having 'except: pass' meant that the
> > record would be skipped and it would proceed to read the next line.
> > However, now when it finds a exception and assert statement is
> > printed.
>
> > Any suggestions on how I can read every record in the file and if an
> > error is encountered then have it just skip that record...without
> > stopping the loop?
>
> --
> Brant Fitzsimmons
> [EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to