#5389: ImportError in daily_cleanup.py after [6087] changeset
--------------------------------------+-------------------------------------
   Reporter:  Boo <[EMAIL PROTECTED]>  |                Owner:  nobody       
     Status:  reopened                |            Component:  Uncategorized
    Version:  SVN                     |           Resolution:               
   Keywords:                          |                Stage:  Unreviewed   
  Has_patch:  0                       |           Needs_docs:  0            
Needs_tests:  0                       |   Needs_better_patch:  0            
--------------------------------------+-------------------------------------
Comment (by [EMAIL PROTECTED]):

 I updated my SVN work copy of Django. Then created new clean project.
 Started there new application.
 Changed settings.py to connect the project to database and added my
 application to list of installed applications. Copied daily.py to root of
 project and exported DJANGO_SETINGS_MODULE.
 Then I was able to import module called "ticket.correct" in Django shell,
 and was no able to run daily_update.py. I did not misspelled any words?
 
 ~/test$ django-admin.py startproject ticket
 ~/test$ cd ticket/
 ~/test/ticket$ ./manage.py --version
 0.97-pre-SVN-6095
 ~/test/ticket$ ./manage.py startapp correct
 ~/test/ticket$ vim settings.py
 {{{INSTALLED_APPS = (
     'django.contrib.auth',
 ...
     'ticket.correct'
 )}}}
 ~/test/ticket$ ls
 correct           __init__.py   manage.py    settings.pyc
 daily_cleanup.py  __init__.pyc  settings.py  urls.py
 ~/test/ticket$ ./daily_cleanup.py
 Traceback (most recent call last):
   File "./daily_cleanup.py", line 20, in <module>
     clean_up()
   File "./daily_cleanup.py", line 16, in clean_up
 Session.objects.filter(expire_date__lt=datetime.datetime.now()).delete()
   File "/usr/local/lib/python2.5/site-packages/django/db/models/query.py",
 line 342, in delete
     for object in del_query[0:GET_ITERATOR_CHUNK_SIZE]:
   File "/usr/local/lib/python2.5/site-packages/django/db/models/query.py",
 line 114, in __iter__
     return iter(self._get_data())
   File "/usr/local/lib/python2.5/site-packages/django/db/models/query.py",
 line 482, in _get_data
     self._result_cache = list(self.iterator())
   File "/usr/local/lib/python2.5/site-packages/django/db/models/query.py",
 line 180, in iterator
     select, sql, params = self._get_sql_clause()
   File "/usr/local/lib/python2.5/site-packages/django/db/models/query.py",
 line 497, in _get_sql_clause
     joins2, where2, params2 = self._filters.get_sql(opts)
   File "/usr/local/lib/python2.5/site-packages/django/db/models/query.py",
 line 719, in get_sql
     joins2, where2, params2 = val.get_sql(opts)
   File "/usr/local/lib/python2.5/site-packages/django/db/models/query.py",
 line 770, in get_sql
     return parse_lookup(self.kwargs.items(), opts)
   File "/usr/local/lib/python2.5/site-packages/django/db/models/query.py",
 line 922, in parse_lookup
     joins2, where2, params2 = lookup_inner(path, lookup_type, value, opts,
 opts.db_table, None)
   File "/usr/local/lib/python2.5/site-packages/django/db/models/query.py",
 line 987, in lookup_inner
     field = find_field(name,
 current_opts.get_all_related_many_to_many_objects(), True)
   File "/usr/local/lib/python2.5/site-
 packages/django/db/models/options.py", line 177, in
 get_all_related_many_to_many_objects
     for klass in get_models():
   File "/usr/local/lib/python2.5/site-
 packages/django/db/models/loading.py", line 134, in get_models
     self._populate()
   File "/usr/local/lib/python2.5/site-
 packages/django/db/models/loading.py", line 55, in _populate
     self.load_app(app_name, True)
   File "/usr/local/lib/python2.5/site-
 packages/django/db/models/loading.py", line 70, in load_app
     mod = __import__(app_name, {}, {}, ['models'])
 ImportError: No module named ticket.correct
 ~/test/ticket$ ./manage.py shell
 Python 2.5.1 (r251:54863, May  2 2007, 16:56:35)
 [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
 Type "help", "copyright", "credits" or "license" for more information.
 (InteractiveConsole)
 >>> import ticket.correct
 >>> dir(ticket.correct)
 ['__builtins__', '__doc__', '__file__', '__name__', '__path__', 'models']

-- 
Ticket URL: <http://code.djangoproject.com/ticket/5389#comment:3>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to