duangenquan / django-cron

Automatically exported from code.google.com/p/django-cron
MIT License
0 stars 0 forks source link

Syncdb exits on fresh install while executing base.py #11

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. import trunk into a fresh project 
2. register app and insert the autodiscover
3. try to run manage.py syncdb

What is the expected output? What do you see instead?
Expected: Create the tables ;)
Got instead: see below for stacktrace
I thinks its the same problem with MySQL as the one you've already "fixed" it 
for SQLite.

The fix which did the trick for me (but which is not meant to be as an all-time 
solution:
At base.py: lines 39+ I've added an

except:
    pass

below the except sqlite3.OperationalError:
    # When you do syncdb for the first time, the table isn't 
    # there yet and throws a nasty error... until now
    pass

Maybe the except should point at _mysql_exceptions.ProgrammingError.

What version of the product are you using? On what operating system?
Version is "trunk", Python 2.6, Django 1.0.2, OS is Mac OS X 10.5.6

Please provide any additional information below.

Traceback (most recent call last):
  File "manage.py", line 11, in <module>
    execute_manager(settings)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-
packages/Django-1.0.2_final-py2.6.egg/django/core/management/__init__.py", line 
340, in 
execute_manager
    utility.execute()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-
packages/Django-1.0.2_final-py2.6.egg/django/core/management/__init__.py", line 
295, in 
execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-
packages/Django-1.0.2_final-py2.6.egg/django/core/management/base.py", line 
192, in 
run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-
packages/Django-1.0.2_final-py2.6.egg/django/core/management/base.py", line 
210, in 
execute
    translation.activate('en-us')
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-
packages/Django-1.0.2_final-py2.6.egg/django/utils/translation/__init__.py", 
line 73, in 
activate
    return real_activate(language)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-
packages/Django-1.0.2_final-py2.6.egg/django/utils/translation/__init__.py", 
line 43, in 
delayed_loader
    return g['real_%s' % caller](*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-
packages/Django-1.0.2_final-py2.6.egg/django/utils/translation/trans_real.py", 
line 209, in 
activate
    _active[currentThread()] = translation(language)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-
packages/Django-1.0.2_final-py2.6.egg/django/utils/translation/trans_real.py", 
line 198, in 
translation
    default_translation = _fetch(settings.LANGUAGE_CODE)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-
packages/Django-1.0.2_final-py2.6.egg/django/utils/translation/trans_real.py", 
line 181, in 
_fetch
    app = getattr(__import__(appname[:p], {}, {}, [appname[p+1:]]), appname[p+1:])
  File "/Users/mario/Documents/workspace/Planet-
Tanzsport/src/planet_tanzsport/../planet_tanzsport/django_cron/__init__.py", 
line 23, in 
<module>
    from base import Job, cron
  File "/Users/mario/Documents/workspace/Planet-
Tanzsport/src/planet_tanzsport/../planet_tanzsport/django_cron/base.py", line 
34, in 
<module>
    for oldJob in oldJobs:
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-
packages/Django-1.0.2_final-py2.6.egg/django/db/models/query.py", line 185, in 
_result_iter
    self._fill_cache()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-
packages/Django-1.0.2_final-py2.6.egg/django/db/models/query.py", line 618, in 
_fill_cache
    self._result_cache.append(self._iter.next())
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-
packages/Django-1.0.2_final-py2.6.egg/django/db/models/query.py", line 275, in 
iterator
    for row in self.query.results_iter():
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-
packages/Django-1.0.2_final-py2.6.egg/django/db/models/sql/query.py", line 206, 
in 
results_iter
    for rows in self.execute_sql(MULTI):
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-
packages/Django-1.0.2_final-py2.6.egg/django/db/models/sql/query.py", line 
1734, in 
execute_sql
    cursor.execute(sql, params)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-
packages/Django-1.0.2_final-py2.6.egg/django/db/backends/util.py", line 19, in 
execute
    return self.cursor.execute(sql, params)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-
packages/Django-1.0.2_final-py2.6.egg/django/db/backends/mysql/base.py", line 
83, in 
execute
    return self.cursor.execute(query, args)
  File "build/bdist.macosx-10.3-i386/egg/MySQLdb/cursors.py", line 173, in execute
  File "build/bdist.macosx-10.3-i386/egg/MySQLdb/connections.py", line 36, in 
defaulterrorhandler
_mysql_exceptions.ProgrammingError: (1146, "Table 
'planet_tanzsport.django_cron_job' doesn't 
exist")

Regards,
Mario

Original issue reported on code.google.com by mario.mu...@gmail.com on 18 Apr 2009 at 5:47

GoogleCodeExporter commented 8 years ago
I get the same error

Original comment by joshuaka...@gmail.com on 21 Apr 2009 at 8:10

GoogleCodeExporter commented 8 years ago
I get this error, similar. _mysql_exceptions.ProgrammingError: (1146, "Table
'database.django_cron_job' doesn't exist")

Original comment by sarp.er...@gmail.com on 25 Apr 2009 at 5:26

GoogleCodeExporter commented 8 years ago
Same here; it seems that the code only works correctly with an sqlite db.

Original comment by mackst...@gmail.com on 11 May 2009 at 5:27

GoogleCodeExporter commented 8 years ago
hey... sorry that was pretty stupid on my part... You'll have to made a small 
edit to
your cron.py files, but the newest version will not have that problem (and it's 
less
resource intensive)

Original comment by Jim.mixt...@gmail.com on 2 Jun 2009 at 2:13

GoogleCodeExporter commented 8 years ago
So I'm going to mark this as fixed. but know that you need to update your 
cron.py files

Original comment by Jim.mixt...@gmail.com on 2 Jun 2009 at 2:14

GoogleCodeExporter commented 8 years ago
For the record, the change you have to make is to import and use cronScheduler 
instead 
of cron.

Original comment by whit537@gmail.com on 27 Aug 2009 at 1:13