views:

206

answers:

3

I am running a basic script that sets up the django environment by itself, to enable me to test the ORM features of django without having to implement web pages. The script then imports one of the types defined in my models. This error doesn't happen when I run this script from iPython, only from eclipse. Simply doing this import causes a weird exception like the following:

Exception AttributeError: "'NoneType' object has no attribute 'print_exc'" in <bound method Signal._remove_receiver of <django.dispatch.dispatcher.Signal object at 0x026802B0>> ignored

My script is as follows:

from django.core.management import setup_environ
import settings
setup_environ(settings)

from stats.models import Person

for p in Person.objects.all():
     print p.Name
A: 

Its possible that eclipse is using a different version of the python interpreter?

Sid NoParrots
There's only one on my machine.
Rhubarb
A: 

Could you give more details, such as the Person model.

Without seeing that I would guess the model attribute is meant to be in lowercase (ie p.name)

lojack
Unfortunately that's not it, because it's printing out the names of all the Person objects, and after completing it throws that exception.
Rhubarb
A: 

As far as i see, you do not havbe any problem with importing your modules. Try this to check if everything you need is ready for you. Probably that would not be the reason of your problem but better you check it too

iPuthon imports django system path automatically, so what you need is alresdy ready under your hands.

import sys
sys.path

check this out to see if all you need is there when you run it from eclipse, fiff with ipython result...

FallenAngel