views:

58

answers:

1

I've never come across this before, but for some strange reason i am getting a Segmentation Fault when running a specific query in Django. On reading up about Segmentation Faults, it seems it might have something to do with the version of Expat that Apache and Python use (and that they are different), what i am unsure about though, is why it has never been a problem for me before? And what is it about my query that causes it to trigger that error?

I am hoping that it is a fault of the query. Is anyone able to shed any light onto this?

Failing Query below:

def run_account_checks():
    # First, do we have any users with zero PAYG?
    d = datetime.now()
    d = d-timedelta(days=14)
    userprofiles = UserProfile.objects.filter(Q(payg_credits__isnull=True) | Q(payg_credits__lt="3.50"))
    userprofiles = userprofiles.filter(Q(lastemailed_paygempty__lte=d) | Q(lastemailed_paygempty__isnull=True))
    userprofiles = userprofiles.filter(user__supplier__isnull=False)
    for up in userprofiles:
        if up.user and up.user.email:
            # Send email to user

            up.lastemailed_paygempty = datetime.now()
            up.save()
A: 

I have this same issue when issuing a delete for any model. Works fine on the Windows dev machine, but not on the Red Hat server. I haven't investigated the Expat issue yet.

Dan