﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
2918	"""ValueError: too many values to unpack""  when doing the tutorial."	tklopp@…	nobody	"hi, I did my first django installation on a debian/unstable.

I installed sqlite3 and pysqlite2 from debian packages. I installed django-0.95 like shown on http://www.djangoproject.com/documentation/install/.

Here's what I entered and what happened (you can see the error at the bottom):

{{{
...
File settings.py saved
tklopp@muschel:~/Projekte/django/mysite$ python manage.py sql polls
BEGIN;
CREATE TABLE ""polls_poll"" (
    ""id"" integer NOT NULL PRIMARY KEY,
    ""question"" varchar(200) NOT NULL,
    ""pub_date"" datetime NOT NULL
);
CREATE TABLE ""polls_choice"" (
    ""id"" integer NOT NULL PRIMARY KEY,
    ""poll_id"" integer NOT NULL REFERENCES ""polls_poll"" (""id""),
    ""choice"" varchar(200) NOT NULL,
    ""votes"" integer NOT NULL
);
COMMIT;
tklopp@muschel:~/Projekte/django/mysite$ python manage.py validate polls
0 errors found.
tklopp@muschel:~/Projekte/django/mysite$ python manage.py sqlinitialdata
polls
BEGIN;
COMMIT;
tklopp@muschel:~/Projekte/django/mysite$ python manage.py syncdb
Creating table polls_poll
Creating table polls_choice
Adding permission 'poll | Can add poll'
Adding permission 'poll | Can change poll'
Adding permission 'poll | Can delete poll'
Adding permission 'choice | Can add choice'
Adding permission 'choice | Can change choice'
Adding permission 'choice | Can delete choice'
tklopp@muschel:~/Projekte/django/mysite$ python manage.py shell
Python 2.4.4c1 (#2, Oct 12 2006, 21:41:47)
[GCC 4.1.2 20061007 (prerelease) (Debian 4.1.1-16)] on linux2
Type ""help"", ""copyright"", ""credits"" or ""license"" for more information.
(InteractiveConsole)
>>> from mysite.polls.models import Poll, Choice
>>> Poll.Objects.all()
Traceback (most recent call last):
  File ""<console>"", line 1, in ?
AttributeError: type object 'Poll' has no attribute 'Objects'
>>> Poll.objects.all()
[]
>>> from datetime import datetime
>>> p = Poll(question=""What's up?"", pub_date=datetime.now())
>>> p.save()
>>> p.id()
Traceback (most recent call last):
  File ""<console>"", line 1, in ?
TypeError: 'int' object is not callable
>>> p.id
1
>>> p.question
""What's up?""
>>> p.pub_date
datetime.datetime(2006, 10, 16, 21, 3, 5, 31007)
>>> p.pub_date = (2006,10,15,21,3,5,31007)
>>> p.save
<bound method Poll.save of <Poll: Poll object>>
>>> p.save)=
  File ""<console>"", line 1
    p.save)=
          ^
SyntaxError: invalid syntax
>>> p.save()
>>> p.pub_date
(2006, 10, 15, 21, 3, 5, 31007)
>>> Poll.objects.all()
Traceback (most recent call last):
  File ""<console>"", line 1, in ?
  File
  ""/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/models/query.py"",
  line 97, in __repr__
    return repr(self._get_data())
  File
""/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/models/query.py"",
line 430, in _get_data
    self._result_cache = list(self.iterator())
  File
""/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/models/query.py"",
line 172, in iterator
    cursor.execute(""SELECT "" + (self._distinct and ""DISTINCT "" or """") +
"","".join(select) + sql, params)
  File
""/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/backends/util.py"",
line 12, in execute
    return self.cursor.execute(sql, params)
  File
""/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/backends/sqlite3/base.py"",
line 77, in execute
    return Database.Cursor.execute(self, query, params)
  File
""/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/backends/util.py"",
line 62, in typecast_timestamp
    d, t = s.split()
ValueError: too many values to unpack
>>> Poll.objects.all()
Traceback (most recent call last):
  File ""<console>"", line 1, in ?
  File
  ""/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/models/query.py"",
  line 97, in __repr__
    return repr(self._get_data())
  File
""/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/models/query.py"",
line 430, in _get_data
    self._result_cache = list(self.iterator())
  File
""/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/models/query.py"",
line 172, in iterator
    cursor.execute(""SELECT "" + (self._distinct and ""DISTINCT "" or """") +
"","".join(select) + sql, params)
  File
""/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/backends/util.py"",
line 12, in execute
    return self.cursor.execute(sql, params)
  File
""/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/backends/sqlite3/base.py"",
line 77, in execute
    return Database.Cursor.execute(self, query, params)
  File
""/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/backends/util.py"",
line 62, in typecast_timestamp
    d, t = s.split()
ValueError: too many values to unpack
>>>
>>>
>>>
>>>
>>> Poll.objects.all()
Traceback (most recent call last):
  File ""<console>"", line 1, in ?
  File
  ""/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/models/query.py"",
  line 97, in __repr__
    return repr(self._get_data())
  File
""/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/models/query.py"",
line 430, in _get_data
    self._result_cache = list(self.iterator())
  File
""/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/models/query.py"",
line 172, in iterator
    cursor.execute(""SELECT "" + (self._distinct and ""DISTINCT "" or """") +
"","".join(select) + sql, params)
  File
""/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/backends/util.py"",
line 12, in execute
    return self.cursor.execute(sql, params)
  File
""/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/backends/sqlite3/base.py"",
line 77, in execute
    return Database.Cursor.execute(self, query, params)
  File
""/usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/backends/util.py"",
line 62, in typecast_timestamp
    d, t = s.split()
ValueError: too many values to unpack
>>> quit
'Use Ctrl-D (i.e. EOF) to exit.'
>>>

tklopp@muschel:~/Projekte/django/mysite$

#######################################################
Next I inserted a line ""print s"" before line 62.
The output was:

>>> Poll.objects.all()
(2006, 10, 15, 21, 3, 5, 31007)
Traceback (most recent call last):
...
}}}
"	defect	closed	Database layer (models, ORM)		blocker	fixed			Accepted	0	0	0	0	0	0
