Re: Hey! I'm recieving an index error when trying to import models, and I can't figure out why.

2013-04-01 Thread Bill Freeman
Stick a print statement between lines 91 and 92 to show you
model_module.__name__ .
(or use pdb if you're comfortable with it).  My best guess is that the
split() is returning a
list of one item.  That is, that there is no '.' in model_module.__name__
.  Thus an index
of -2 failss: there is no penultimate item.

At least for the time when it gets the exception.  That is, you may get
many lines printed,
but the last one before the exception won't have a '.'


On Mon, Apr 1, 2013 at 1:48 PM, C Alaric Moore wrote:

> I just tried this and still have the same error. I also might add that I'm
> using a mac with an updated os. I also hear that it could be an issue of
> line breaks, but can't find any /n's or /r's in any of the code anyway. I
> might just be looking in the wrong places, too.
>
>
> On Sunday, March 31, 2013 9:33:21 PM UTC-7, jondbaker wrote:
>
>> When importing Python modules, you don't need to include the '.py' file
>> extension. So,
>> from models.py import UUID
>> ...needs to be:
>> from models import UUID
>>
>> Hope this helps,
>> Jonathan
>>
>>
>> On Sun, Mar 31, 2013 at 10:27 PM, C Alaric Moore wrote:
>>
>>> Hello,
>>>
>>> I am incredibly new to Django, as-of-today new, so forgive me if I've
>>> missed something really obvious.
>>>
>>> I've been going through the tutorial and did so mostly-successfully and
>>> decided to redo it with my own code.
>>>
>>> Everything was going fine until I decided that it would be a good idea
>>> to type from models.py import UUID, Students into the shell. With this I
>>> received the following error:
>>>
>>> /Library/Frameworks/Python.**framework/Versions/7.3/lib/**
>>> python2.7/site-packages/**django/db/models/base.pyc in __new__(cls,
>>> name, bases, attrs)
>>>  90 # For 'django.contrib.sites.models', this would be
>>> 'sites'.
>>>
>>>  91 model_module = sys.modules[new_class.__**module__]
>>> ---> 92 kwargs = {"app_label": model_module.__name__.split('.
>>> **')[-2]}
>>>  93 else:
>>>  94 kwargs = {}
>>>
>>> IndexError: list index out of range
>>>
>>> I went onto stackoverflow and found some people had similar issues a
>>> year ago, and suggested that a person delete the pyc files, which I did. It
>>> was also suggested that you make DEBUGGING = False, or True or whatever is
>>> opposite. I did this, too, only to find the same error.
>>>
>>> I did some other things too, all to no avail... all the same error. I
>>> even checked to make sure I was saving edited files, TWICE. Still, same
>>> error.
>>>
>>> With this, I ask for your help o' wise ones.
>>>
>>> Thanks.
>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@**googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>>
>>> Visit this group at 
>>> http://groups.google.com/**group/django-users?hl=en
>>> .
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out
>>> .
>>>
>>>
>>>
>>
>>
>>
>> --
>> Jonathan D. Baker
>> Developer
>> http://jonathandbaker.com
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Hey! I'm recieving an index error when trying to import models, and I can't figure out why.

2013-04-01 Thread C Alaric Moore
I just tried this and still have the same error. I also might add that I'm 
using a mac with an updated os. I also hear that it could be an issue of 
line breaks, but can't find any /n's or /r's in any of the code anyway. I 
might just be looking in the wrong places, too. 

On Sunday, March 31, 2013 9:33:21 PM UTC-7, jondbaker wrote:
>
> When importing Python modules, you don't need to include the '.py' file 
> extension. So,
> from models.py import UUID
> ...needs to be:
> from models import UUID
>
> Hope this helps,
> Jonathan
>
>
> On Sun, Mar 31, 2013 at 10:27 PM, C Alaric Moore 
>  > wrote:
>
>> Hello, 
>>
>> I am incredibly new to Django, as-of-today new, so forgive me if I've 
>> missed something really obvious. 
>>
>> I've been going through the tutorial and did so mostly-successfully and 
>> decided to redo it with my own code. 
>>
>> Everything was going fine until I decided that it would be a good idea to 
>> type from models.py import UUID, Students into the shell. With this I 
>> received the following error: 
>>
>> /Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/django/db/models/base.pyc
>>  
>> in __new__(cls, name, bases, attrs)
>>  90 # For 'django.contrib.sites.models', this would be 
>> 'sites'.
>>
>>  91 model_module = sys.modules[new_class.__module__]
>> ---> 92 kwargs = {"app_label": 
>> model_module.__name__.split('.')[-2]}
>>  93 else:
>>  94 kwargs = {}
>>
>> IndexError: list index out of range
>>
>> I went onto stackoverflow and found some people had similar issues a year 
>> ago, and suggested that a person delete the pyc files, which I did. It was 
>> also suggested that you make DEBUGGING = False, or True or whatever is 
>> opposite. I did this, too, only to find the same error. 
>>
>> I did some other things too, all to no avail... all the same error. I 
>> even checked to make sure I was saving edited files, TWICE. Still, same 
>> error. 
>>
>> With this, I ask for your help o' wise ones. 
>>
>> Thanks. 
>>
>>
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>
>
> -- 
> Jonathan D. Baker
> Developer
> http://jonathandbaker.com
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Hey! I'm recieving an index error when trying to import models, and I can't figure out why.

2013-03-31 Thread Jonathan Baker
When importing Python modules, you don't need to include the '.py' file
extension. So,
from models.py import UUID
...needs to be:
from models import UUID

Hope this helps,
Jonathan


On Sun, Mar 31, 2013 at 10:27 PM, C Alaric Moore wrote:

> Hello,
>
> I am incredibly new to Django, as-of-today new, so forgive me if I've
> missed something really obvious.
>
> I've been going through the tutorial and did so mostly-successfully and
> decided to redo it with my own code.
>
> Everything was going fine until I decided that it would be a good idea to
> type from models.py import UUID, Students into the shell. With this I
> received the following error:
>
> /Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/django/db/models/base.pyc
> in __new__(cls, name, bases, attrs)
>  90 # For 'django.contrib.sites.models', this would be
> 'sites'.
>
>  91 model_module = sys.modules[new_class.__module__]
> ---> 92 kwargs = {"app_label":
> model_module.__name__.split('.')[-2]}
>  93 else:
>  94 kwargs = {}
>
> IndexError: list index out of range
>
> I went onto stackoverflow and found some people had similar issues a year
> ago, and suggested that a person delete the pyc files, which I did. It was
> also suggested that you make DEBUGGING = False, or True or whatever is
> opposite. I did this, too, only to find the same error.
>
> I did some other things too, all to no avail... all the same error. I even
> checked to make sure I was saving edited files, TWICE. Still, same error.
>
> With this, I ask for your help o' wise ones.
>
> Thanks.
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Jonathan D. Baker
Developer
http://jonathandbaker.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Hey! I'm recieving an index error when trying to import models, and I can't figure out why.

2013-03-31 Thread C Alaric Moore
Hello, 

I am incredibly new to Django, as-of-today new, so forgive me if I've 
missed something really obvious. 

I've been going through the tutorial and did so mostly-successfully and 
decided to redo it with my own code. 

Everything was going fine until I decided that it would be a good idea to 
type from models.py import UUID, Students into the shell. With this I 
received the following error: 

/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/django/db/models/base.pyc
 
in __new__(cls, name, bases, attrs)
 90 # For 'django.contrib.sites.models', this would be 
'sites'.

 91 model_module = sys.modules[new_class.__module__]
---> 92 kwargs = {"app_label": 
model_module.__name__.split('.')[-2]}
 93 else:
 94 kwargs = {}

IndexError: list index out of range

I went onto stackoverflow and found some people had similar issues a year 
ago, and suggested that a person delete the pyc files, which I did. It was 
also suggested that you make DEBUGGING = False, or True or whatever is 
opposite. I did this, too, only to find the same error. 

I did some other things too, all to no avail... all the same error. I even 
checked to make sure I was saving edited files, TWICE. Still, same error. 

With this, I ask for your help o' wise ones. 

Thanks. 


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.