Hi Nathan.

On Mar 21, 12:37 am, "Nathan Harmston" <[EMAIL PROTECTED]>
wrote:
> My Project is called pynomics and the app alignments.
> ~/pynomics/alignments/models.py
>
> so in my "Parser.py", I try to import the models file
> from pynomics.alignments.models import *
>
> but I get the following error when I try to run it:
> Traceback (most recent call last):
>   File "Parser.py", line 1, in ?
>     from pynomics.pyalignments.models import Interval
> ImportError: No module named pynomics.pyalignments.models

Python can't find the pynomics module to import because it is not in
the search path.

A simple workaround would be to add the path that contains pynomics
(i.e. your home directory) to sys.path in your Parser.py.

import sys
sys.path.append("/home/nathan/")

You can also add the path to a PYTHONPATH environment variable or put
a symlink to pynomics in your site-packages directory (which is
somewhere like /usr/lib/python2.4/site-packages).

> However the import seems to work when I import it in views.py.

Yeah, Django sets it up in the path for you if you do manage.py
runserver.

The next error you'll probably get is about DJANGO_SETTINGS_MODULE not
being set.  This means the Django framework doesn't know where to find
the settings for database connection, etc.

Again in your Parser.py script, try:

import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'pynomics.settings'

Sorry if I'm a bit vague - I'm new to Python and this is just what
I've figured out.

Scott


--~--~---------~--~----~------------~-------~--~----~
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