Hello,
I was using the python shell to test my Django model, and I got this
error :
In [91]: MediaCollection.objects.by_country("gabon")
Out[91]: ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (12, 0))
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (72, 0))
ERROR: Internal Python error in the inspect module.
Below is the traceback from this internal error.
Traceback (most recent call last):
File "/var/lib/python-support/python2.5/IPython/ultraTB.py", line
662, in text
locals,formatvalue=var_repr))
File "/usr/lib/python2.5/inspect.py", line 812, in formatargvalues
specs.append(strseq(args[i], convert, join))
File "/usr/lib/python2.5/inspect.py", line 767, in strseq
return convert(object)
File "/usr/lib/python2.5/inspect.py", line 809, in convert
return formatarg(name) + formatvalue(locals[name])
KeyError: 'connection'
IPython's exception reporting continues...
---------------------------------------------------------------------------
ValueError Traceback (most recent call
last)
/home/david/dev/cremtest/<ipython console> in <module>()
/var/lib/python-support/python2.5/IPython/Prompts.pyc in __call__
(self, arg)
549
550 # and now call a possibly user-defined print
mechanism
--> 551 manipulated_val = self.display(arg)
552
553 # user display hooks can change the variable to be
stored in
/var/lib/python-support/python2.5/IPython/Prompts.pyc in _display
(self, arg)
575 return IPython.generics.result_display(arg)
576 except TryNext:
--> 577 return self.shell.hooks.result_display(arg)
578
579 # Assign the default display method:
/var/lib/python-support/python2.5/IPython/hooks.pyc in __call__(self,
*args, **kw)
133 #print "prio",prio,"cmd",cmd #dbg
134 try:
--> 135 ret = cmd(*args, **kw)
136 return ret
137 except ipapi.TryNext, exc:
/var/lib/python-support/python2.5/IPython/hooks.pyc in result_display
(self, arg)
163
164 if self.rc.pprint:
--> 165 out = pformat(arg)
166 if '\n' in out:
167 # So that multi-line strings line up with the left
column of
/usr/lib/python2.5/pprint.pyc in pformat(self, object)
109 def pformat(self, object):
110 sio = _StringIO()
--> 111 self._format(object, sio, 0, 0, {}, 0)
112 return sio.getvalue()
113
/usr/lib/python2.5/pprint.pyc in _format(self, object, stream, indent,
allowance, context, level)
127 self._readable = False
128 return
--> 129 rep = self._repr(object, context, level - 1)
130 typ = _type(object)
131 sepLines = _len(rep) > (self._width - 1 - indent -
allowance)
/usr/lib/python2.5/pprint.pyc in _repr(self, object, context, level)
193 def _repr(self, object, context, level):
194 repr, readable, recursive = self.format(object,
context.copy(),
--> 195 self._depth,
level)
196 if not readable:
197 self._readable = False
/usr/lib/python2.5/pprint.pyc in format(self, object, context,
maxlevels, level)
205 and whether the object represents a recursive
construct.
206 """
--> 207 return _safe_repr(object, context, maxlevels, level)
208
209
/usr/lib/python2.5/pprint.pyc in _safe_repr(object, context,
maxlevels, level)
290 return format % _commajoin(components), readable,
recursive
291
--> 292 rep = repr(object)
293 return rep, (rep and not rep.startswith('<')), False
294
/var/lib/python-support/python2.5/django/db/models/query.pyc in
__repr__(self)
145
146 def __repr__(self):
--> 147 data = list(self[:REPR_OUTPUT_SIZE + 1])
148 if len(data) > REPR_OUTPUT_SIZE:
149 data[-1] = "...(remaining elements truncated)..."
/var/lib/python-support/python2.5/django/db/models/query.pyc in __len__
(self)
160 self._result_cache = list(self.iterator())
161 elif self._iter:
--> 162 self._result_cache.extend(list(self._iter))
163 return len(self._result_cache)
164
/var/lib/python-support/python2.5/django/db/models/query.pyc in
iterator(self)
273 extra_select = self.query.extra_select.keys()
274 index_start = len(extra_select)
--> 275 for row in self.query.results_iter():
276 if fill_cache:
277 obj, _ = get_cached_row(self.model, row,
index_start,
/var/lib/python-support/python2.5/django/db/models/sql/query.pyc in
results_iter(self)
204 resolve_columns = hasattr(self, 'resolve_columns')
205 fields = None
--> 206 for rows in self.execute_sql(MULTI):
207 for row in rows:
208 if resolve_columns:
/var/lib/python-support/python2.5/django/db/models/sql/query.pyc in
execute_sql(self, result_type)
1732
1733 cursor = self.connection.cursor()
-> 1734 cursor.execute(sql, params)
1735
1736 if not result_type:
/var/lib/python-support/python2.5/django/db/backends/util.pyc in
execute(self, sql, params)
17 start = time()
18 try:
---> 19 return self.cursor.execute(sql, params)
20 finally:
21 stop = time()
/var/lib/python-support/python2.5/django/db/backends/mysql/base.pyc in
execute(self, query, args)
81 def execute(self, query, args=None):
82 try:
---> 83 return self.cursor.execute(query, args)
84 except Database.OperationalError, e:
85 # Map some error codes to IntegrityError, since
they seem to be
/var/lib/python-support/python2.5/MySQLdb/cursors.pyc in execute(self,
query, args)
164 del tb
165 self.messages.append((exc, value))
--> 166 self.errorhandler(self, exc, value)
167 self._executed = query
168 if not self._defer_warnings: self._warning_check()
/var/lib/python-support/python2.5/MySQLdb/connections.pyc in
defaulterrorhandler(***failed resolving arguments***)
33 del cursor
34 del connection
---> 35 raise errorclass, errorvalue
36
37
ValueError: hour must be in 0..23
It seems to be related to IPython but I don't understand the error.
Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---