Re: error psycopg in Django/MacOSX
Daniel França <[email protected]> Thu, 5 Aug 2010 00:19:13 -0300
| Newsgroups | gmane.comp.python.db.psycopg.devel |
|---|---|
| Message-ID | <[email protected]> |
--===============0266969394371564857==
Content-Type: multipart/alternative; boundary=00c09f99e571e6efed048d0b04e6
--00c09f99e571e6efed048d0b04e6
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
I think I found exactly where the error happens and I reproduced it in the
shell:
>>> from django.contrib.auth.models import User
>>> new_user =3D User.objects.create_user("daniel", "[email protected]=
m",
"daniel")
Traceback (most recent call last):
File "<console>", line 1, in <module>
File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa=
ges/django/contrib/auth/models.py",
line 129, in create_user
user.save(using=3Dself._db)
File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa=
ges/django/db/models/base.py",
line 435, in save
self.save_base(using=3Dusing, force_insert=3Dforce_insert,
force_update=3Dforce_update)
File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa=
ges/django/db/models/base.py",
line 543, in save_base
created=3D(not record_exists), raw=3Draw)
File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa=
ges/django/dispatch/dispatcher.py",
line 162, in send
response =3D receiver(signal=3Dself, sender=3Dsender, **named)
File
"/Users/danielfranca/workspace/django/view/tint/apps/account/models.py",
line 60, in create_account
account, created =3D Account.objects.get_or_create(user=3Dinstance)
File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa=
ges/django/db/models/manager.py",
line 135, in get_or_create
return self.get_query_set().get_or_create(**kwargs)
File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa=
ges/django/db/models/query.py",
line 373, in get_or_create
obj.save(force_insert=3DTrue, using=3Dself.db)
File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa=
ges/django/db/models/base.py",
line 435, in save
self.save_base(using=3Dusing, force_insert=3Dforce_insert,
force_update=3Dforce_update)
File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa=
ges/django/db/models/base.py",
line 528, in save_base
result =3D manager._insert(values, return_id=3Dupdate_pk, using=3Dusing=
)
File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa=
ges/django/db/models/manager.py",
line 195, in _insert
return insert_query(self.model, values, **kwargs)
File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa=
ges/django/db/models/query.py",
line 1479, in insert_query
return query.get_compiler(using=3Dusing).execute_sql(return_id)
File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa=
ges/django/db/models/sql/compiler.py",
line 783, in execute_sql
cursor =3D super(SQLInsertCompiler, self).execute_sql(None)
File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa=
ges/django/db/models/sql/compiler.py",
line 727, in execute_sql
cursor.execute(sql, params)
File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa=
ges/django/db/backends/util.py",
line 15, in execute
return self.cursor.execute(sql, params)
File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packa=
ges/django/db/backends/postgresql_psycopg2/base.py",
line 44, in execute
return self.cursor.execute(query, args)
DatabaseError: can't adapt type 'US/Eastern'
it's when I try to create a new user, maybe it has nothing to do with
psycopg, right?
2010/8/4 Daniele Varrazzo <[email protected]>
> 2010/8/4 Daniele Varrazzo <[email protected]>:
> > 2010/8/4 Daniel Fran=E7a <[email protected]>:
> >> My output is below, and my version of Django is 1.2.1 as you can see
> below.
> >> I had to include other imports and lines to allow the right output (is
> it a
> >> bad thing?)
> >
> > "manage.py shell" configures this stuff for you
> >
> >>>>> type(settings.TIME_ZONE)
> >> <type 'str'>
> >
> > So it's a plain string, the error "can't adapt 'US/Eastern'" can't
> > come from there. If there was a problem in psycopg and the string
> > adapter was not registered, you would get a "can't adapt type 'str'"
> > error, with the type name, not the value.
> >
> > Can you post an example of what you are doing that gives you the
> > error? Can you reproduce it in an interactive shell?
> >
> > -- Daniele
> >
>
> We have left the mailing list out of this discussion. Please include
> it again in your answer.
>
> -- Daniele
>
--00c09f99e571e6efed048d0b04e6
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
I think I found exactly where the error happens and I reproduced it in the =
shell:<div><br></div><div><div>>>> from django.contrib.auth.models=
import User</div><div>>>> new_user =3D User.objects.create_user(&=
quot;daniel", "<a href=3D"mailto:[email protected]">daniel.=
[email protected]</a>", "daniel")</div>
<div>Traceback (most recent call last):</div><div>=A0=A0File "<cons=
ole>", line 1, in <module></div><div>=A0=A0File "/Librar=
y/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/djan=
go/contrib/auth/models.py", line 129, in create_user</div>
<div>=A0=A0 =A0user.save(using=3Dself._db)</div><div>=A0=A0File "/Libr=
ary/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dj=
ango/db/models/base.py", line 435, in save</div><div>=A0=A0 =A0self.sa=
ve_base(using=3Dusing, force_insert=3Dforce_insert, force_update=3Dforce_up=
date)</div>
<div>=A0=A0File "/Library/Frameworks/Python.framework/Versions/2.7/lib=
/python2.7/site-packages/django/db/models/base.py", line 543, in save_=
base</div><div>=A0=A0 =A0created=3D(not record_exists), raw=3Draw)</div><di=
v>=A0=A0File "/Library/Frameworks/Python.framework/Versions/2.7/lib/py=
thon2.7/site-packages/django/dispatch/dispatcher.py", line 162, in sen=
d</div>
<div>=A0=A0 =A0response =3D receiver(signal=3Dself, sender=3Dsender, **name=
d)</div><div>=A0=A0File "/Users/danielfranca/workspace/django/view/tin=
t/apps/account/models.py", line 60, in create_account</div><div>=A0=A0=
=A0account, created =3D Account.objects.get_or_create(user=3Dinstance)</di=
v>
<div>=A0=A0File "/Library/Frameworks/Python.framework/Versions/2.7/lib=
/python2.7/site-packages/django/db/models/manager.py", line 135, in ge=
t_or_create</div><div>=A0=A0 =A0return self.get_query_set().get_or_create(*=
*kwargs)</div>
<div>=A0=A0File "/Library/Frameworks/Python.framework/Versions/2.7/lib=
/python2.7/site-packages/django/db/models/query.py", line 373, in get_=
or_create</div><div>=A0=A0 =A0obj.save(force_insert=3DTrue, using=3Dself.db=
)</div><div>
=A0=A0File "/Library/Frameworks/Python.framework/Versions/2.7/lib/pyth=
on2.7/site-packages/django/db/models/base.py", line 435, in save</div>=
<div>=A0=A0 =A0self.save_base(using=3Dusing, force_insert=3Dforce_insert, f=
orce_update=3Dforce_update)</div>
<div>=A0=A0File "/Library/Frameworks/Python.framework/Versions/2.7/lib=
/python2.7/site-packages/django/db/models/base.py", line 528, in save_=
base</div><div>=A0=A0 =A0result =3D manager._insert(values, return_id=3Dupd=
ate_pk, using=3Dusing)</div>
<div>=A0=A0File "/Library/Frameworks/Python.framework/Versions/2.7/lib=
/python2.7/site-packages/django/db/models/manager.py", line 195, in _i=
nsert</div><div>=A0=A0 =A0return insert_query(self.model, values, **kwargs)=
</div>
<div>=A0=A0File "/Library/Frameworks/Python.framework/Versions/2.7/lib=
/python2.7/site-packages/django/db/models/query.py", line 1479, in ins=
ert_query</div><div>=A0=A0 =A0return query.get_compiler(using=3Dusing).exec=
ute_sql(return_id)</div>
<div>=A0=A0File "/Library/Frameworks/Python.framework/Versions/2.7/lib=
/python2.7/site-packages/django/db/models/sql/compiler.py", line 783, =
in execute_sql</div><div>=A0=A0 =A0cursor =3D super(SQLInsertCompiler, self=
).execute_sql(None)</div>
<div>=A0=A0File "/Library/Frameworks/Python.framework/Versions/2.7/lib=
/python2.7/site-packages/django/db/models/sql/compiler.py", line 727, =
in execute_sql</div><div>=A0=A0 =A0cursor.execute(sql, params)</div><div>=
=A0=A0File "/Library/Frameworks/Python.framework/Versions/2.7/lib/pyth=
on2.7/site-packages/django/db/backends/util.py", line 15, in execute</=
div>
<div>=A0=A0 =A0return self.cursor.execute(sql, params)</div><div>=A0=A0File=
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site=
-packages/django/db/backends/postgresql_psycopg2/base.py", line 44, in=
execute</div>
<div>=A0=A0 =A0return self.cursor.execute(query, args)</div><div>DatabaseEr=
ror: can't adapt type 'US/Eastern'</div><div><br></div><div>it&=
#39;s when I try to create a new user, maybe it has nothing to do with psyc=
opg, right?</div>
<br><div class=3D"gmail_quote">2010/8/4 Daniele Varrazzo <span dir=3D"ltr">=
<<a href=3D"mailto:[email protected]">[email protected]=
m</a>></span><br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0=
.8ex;border-left:1px #ccc solid;padding-left:1ex;">
2010/8/4 Daniele Varrazzo <<a href=3D"mailto:[email protected]"=
>[email protected]</a>>:<br>
<div><div></div><div class=3D"h5">> 2010/8/4 Daniel Fran=E7a <<a href=
=3D"mailto:[email protected]">[email protected]</a>>:<br>
>> My output is below, and my version of Django is 1.2.1 as you can s=
ee below.<br>
>> I had to include other imports and lines to allow the right output=
(is it a<br>
>> bad thing?)<br>
><br>
> "manage.py shell" configures this stuff for you<br>
><br>
>>>>> type(settings.TIME_ZONE)<br>
>> <type 'str'><br>
><br>
> So it's a plain string, the error "can't adapt 'US/Ea=
stern'" can't<br>
> come from there. If there was a problem in psycopg and the string<br>
> adapter was not registered, you would get a "can't adapt type=
'str'"<br>
> error, with the type name, not the value.<br>
><br>
> =A0Can you post an example of what you are doing that gives you the<br=
>
> error? Can you reproduce it in an interactive shell?<br>
><br>
> -- Daniele<br>
><br>
<br>
</div></div>We have left the mailing list out of this discussion. Please in=
clude<br>
it again in your answer.<br>
<font color=3D"#888888"><br>
-- Daniele<br>
</font></blockquote></div><br></div>
--00c09f99e571e6efed048d0b04e6--
--===============0266969394371564857==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Psycopg mailing list
Psycopg-IAPFreCvJWPBWskQ1e/[email protected]
http://lists.initd.org/mailman/listinfo/psycopg
--===============0266969394371564857==--