Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: Users

psycopg import error

 

 

Zope users RSS feed   Index | Next | Previous | View Threaded


fixer.solver at gmail

Jun 23, 2009, 1:06 PM

Post #1 of 10 (1118 views)
Permalink
psycopg import error

Hi,
I have (Zope 2.9.4-final, python 2.4.3, linux2) and I have used
psycopg2.0.11 adapter to connect Zope to Postgresql but I am getting this
error when I try to add the connection object the error is :-

Error Type: ImportError

Error Value: psycopg version mismatch (imported 2.0.11 (dt dec ext pq3))

while the event log traceback shows that :-

2009-06-23T10:55:49 ERROR Shared.DC.ZRDB.Connection Error connecting to
relational database.
Traceback (most recent call last):
File "/opt/Plone-2.5/lib/python/Shared/DC/ZRDB/Connection.py", line 71, in
__setstate__
try: self.connect(self.connection_string)
File "/opt/Plone-2.5/zeocluster/client1/Products/ZPsycopgDA/DA.py", line
120, in connect
raise ImportError("psycopg version mismatch (imported %s)" %
ImportError: psycopg version mismatch (imported 2.0.11 (dt dec ext pq3))

I would appreciate for an answer asap.

Thanks
Amir

tlc2

***
*


bennetttm at appstate

Jun 23, 2009, 1:41 PM

Post #2 of 10 (1052 views)
Permalink
Re: psycopg import error [In reply to]

Have you installed psycopg2 2.0.11, not the adapter but the library for
python? and is it in the python path for your Zope python?

I'm thinking you have psycopg not psycopg2 installed as your python library
and the psycopg2 adapter. There is no psycopg 2.0.11.

I am assuming this is still how psycopg is installed, the library and the DA
product.

http://initd.org/pub/software/psycopg/


Thomas



On Tuesday 23 June 2009 16:06:03 Amir wrote:
> Hi,
> I have (Zope 2.9.4-final, python 2.4.3, linux2) and I have used
> psycopg2.0.11 adapter to connect Zope to Postgresql but I am getting this
> error when I try to add the connection object the error is :-
>
> Error Type: ImportError
>
> Error Value: psycopg version mismatch (imported 2.0.11 (dt dec ext pq3))
>
> while the event log traceback shows that :-
>
> 2009-06-23T10:55:49 ERROR Shared.DC.ZRDB.Connection Error connecting to
> relational database.
> Traceback (most recent call last):
> File "/opt/Plone-2.5/lib/python/Shared/DC/ZRDB/Connection.py", line 71,
> in __setstate__
> try: self.connect(self.connection_string)
> File "/opt/Plone-2.5/zeocluster/client1/Products/ZPsycopgDA/DA.py", line
> 120, in connect
> raise ImportError("psycopg version mismatch (imported %s)" %
> ImportError: psycopg version mismatch (imported 2.0.11 (dt dec ext pq3))
>
> I would appreciate for an answer asap.
>
> Thanks
> Amir
>
> tlc2
>
> ***
> *

--
Normally I'm against big things,
I think the world is going to be saved by millions of small things.
Too many things can go wrong when they get big.
- Pete Seeger at his 90th birthday party Sunday May 3, 2009

==========================================
Thomas McMillan Grant Bennett Appalachian State University
Operations & Systems Analyst P O Box 32026
University Library Boone, North Carolina 28608
(828) 262 6587

Library Systems Help Desk: https://www.library.appstate.edu/help/
==========================================
_______________________________________________
Zope maillist - Zope[at]zope.org
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )


fixer.solver at gmail

Jun 24, 2009, 8:49 AM

Post #3 of 10 (1046 views)
Permalink
Re: psycopg import error [In reply to]

Hey,
yes i have it installed at
instance/Python-2.4.3/lib/python2.4/site-packages/psycopg2 and i had also
moved the adapter to the
instance/client1/Products folder, but still it is giving me the version
mismatch error. Also i checked the psycopg* in my system but
over there also i can see that it is correct version that has been installed
/usr/lib/python2.4/site-packages/psycopg2 .

Regards,
Amir

tlc2

On Tue, Jun 23, 2009 at 3:41 PM, Thomas Bennett <bennetttm[at]appstate.edu>wrote:

> Have you installed psycopg2 2.0.11, not the adapter but the library for
> python? and is it in the python path for your Zope python?
>
> I'm thinking you have psycopg not psycopg2 installed as your python library
> and the psycopg2 adapter. There is no psycopg 2.0.11.
>
> I am assuming this is still how psycopg is installed, the library and the
> DA
> product.
>
> http://initd.org/pub/software/psycopg/
>
>
> Thomas
>
>
>
> On Tuesday 23 June 2009 16:06:03 Amir wrote:
> > Hi,
> > I have (Zope 2.9.4-final, python 2.4.3, linux2) and I have used
> > psycopg2.0.11 adapter to connect Zope to Postgresql but I am getting this
> > error when I try to add the connection object the error is :-
> >
> > Error Type: ImportError
> >
> > Error Value: psycopg version mismatch (imported 2.0.11 (dt dec ext pq3))
> >
> > while the event log traceback shows that :-
> >
> > 2009-06-23T10:55:49 ERROR Shared.DC.ZRDB.Connection Error connecting to
> > relational database.
> > Traceback (most recent call last):
> > File "/opt/Plone-2.5/lib/python/Shared/DC/ZRDB/Connection.py", line 71,
> > in __setstate__
> > try: self.connect(self.connection_string)
> > File "/opt/Plone-2.5/zeocluster/client1/Products/ZPsycopgDA/DA.py",
> line
> > 120, in connect
> > raise ImportError("psycopg version mismatch (imported %s)" %
> > ImportError: psycopg version mismatch (imported 2.0.11 (dt dec ext pq3))
> >
> > I would appreciate for an answer asap.
> >
> > Thanks
> > Amir
> >
> > tlc2
> >
> > ***
> > *
>
> --
> Normally I'm against big things,
> I think the world is going to be saved by millions of small things.
> Too many things can go wrong when they get big.
> - Pete Seeger at his 90th birthday party Sunday May 3, 2009
>
> ==========================================
> Thomas McMillan Grant Bennett Appalachian State University
> Operations & Systems Analyst P O Box 32026
> University Library Boone, North Carolina
> 28608
> (828) 262 6587
>
> Library Systems Help Desk: https://www.library.appstate.edu/help/
> ==========================================
> _______________________________________________
> Zope maillist - Zope[at]zope.org
> http://mail.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )
>


rwoodhouse at wirelessmeasurement

Jun 24, 2009, 8:56 AM

Post #4 of 10 (1044 views)
Permalink
Re: psycopg import error [In reply to]

I had the same problem but found that if I just modified the list of
acceptable psycopg versions everything worked fine.

Rowan

Amir wrote:
> Hey,
> yes i have it installed at
> instance/Python-2.4.3/lib/python2.4/site-packages/psycopg2 and i had also
> moved the adapter to the
> instance/client1/Products folder, but still it is giving me the version
> mismatch error. Also i checked the psycopg* in my system but
> over there also i can see that it is correct version that has been installed
> /usr/lib/python2.4/site-packages/psycopg2 .
>
> Regards,
> Amir
>
> tlc2
>
> On Tue, Jun 23, 2009 at 3:41 PM, Thomas Bennett <bennetttm[at]appstate.edu>wrote:
>
>> Have you installed psycopg2 2.0.11, not the adapter but the library for
>> python? and is it in the python path for your Zope python?
>>
>> I'm thinking you have psycopg not psycopg2 installed as your python library
>> and the psycopg2 adapter. There is no psycopg 2.0.11.
>>
>> I am assuming this is still how psycopg is installed, the library and the
>> DA
>> product.
>>
>> http://initd.org/pub/software/psycopg/
>>
>>
>> Thomas
>>
>>
>>
>> On Tuesday 23 June 2009 16:06:03 Amir wrote:
>>> Hi,
>>> I have (Zope 2.9.4-final, python 2.4.3, linux2) and I have used
>>> psycopg2.0.11 adapter to connect Zope to Postgresql but I am getting this
>>> error when I try to add the connection object the error is :-
>>>
>>> Error Type: ImportError
>>>
>>> Error Value: psycopg version mismatch (imported 2.0.11 (dt dec ext pq3))
>>>
>>> while the event log traceback shows that :-
>>>
>>> 2009-06-23T10:55:49 ERROR Shared.DC.ZRDB.Connection Error connecting to
>>> relational database.
>>> Traceback (most recent call last):
>>> File "/opt/Plone-2.5/lib/python/Shared/DC/ZRDB/Connection.py", line 71,
>>> in __setstate__
>>> try: self.connect(self.connection_string)
>>> File "/opt/Plone-2.5/zeocluster/client1/Products/ZPsycopgDA/DA.py",
>> line
>>> 120, in connect
>>> raise ImportError("psycopg version mismatch (imported %s)" %
>>> ImportError: psycopg version mismatch (imported 2.0.11 (dt dec ext pq3))
>>>
>>> I would appreciate for an answer asap.
>>>
>>> Thanks
>>> Amir
>>>
>>> tlc2
>>>
>>> ***
>>> *
>> --
>> Normally I'm against big things,
>> I think the world is going to be saved by millions of small things.
>> Too many things can go wrong when they get big.
>> - Pete Seeger at his 90th birthday party Sunday May 3, 2009
>>
>> ==========================================
>> Thomas McMillan Grant Bennett Appalachian State University
>> Operations & Systems Analyst P O Box 32026
>> University Library Boone, North Carolina
>> 28608
>> (828) 262 6587
>>
>> Library Systems Help Desk: https://www.library.appstate.edu/help/
>> ==========================================
>> _______________________________________________
>> Zope maillist - Zope[at]zope.org
>> http://mail.zope.org/mailman/listinfo/zope
>> ** No cross posts or HTML encoding! **
>> (Related lists -
>> http://mail.zope.org/mailman/listinfo/zope-announce
>> http://mail.zope.org/mailman/listinfo/zope-dev )
>>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Zope maillist - Zope[at]zope.org
> http://mail.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )

_______________________________________________
Zope maillist - Zope[at]zope.org
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )


fixer.solver at gmail

Jun 24, 2009, 9:23 AM

Post #5 of 10 (1045 views)
Permalink
Re: psycopg import error [In reply to]

Things that i have noticed

1)running and importing psycopg2

gives this error

Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.4/site-packages/psycopg2/__init__.py", line 60, in
?
from _psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: /usr/lib/python2.4/site-packages/psycopg2/_psycopg.so:
undefined symbol: PyUnicodeUCS2_Decode

2) for some reason in the Python-2.4.3/lib/python2.4/site-packages/psycopg2
it has psycopg1.py so when i open it, it
says in order to import do:- "from psycopg2 import psycopg1 as psycopg"(also
says to run in psycopg1.1.x compatible mode) and if i do import it this way
it gives me this error

Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.4/site-packages/psycopg2/__init__.py", line 55, in
?
from psycopg2 import tz
ImportError: cannot import name tz

I am thinking there is something in 2) is this normal?



ps : 2.0.11 is in the allowed psycopg ALLOWED_PSYCOPG_VERSIONS =
('2.0.7','2.0.8','2.0.9','2.0.10', '2.0.11')


Regards,
Amir

tlc2

On Wed, Jun 24, 2009 at 10:56 AM, Rowan Woodhouse <
rwoodhouse[at]wirelessmeasurement.com> wrote:

> I had the same problem but found that if I just modified the list of
> acceptable psycopg versions everything worked fine.
>
> Rowan
>
> Amir wrote:
> > Hey,
> > yes i have it installed at
> > instance/Python-2.4.3/lib/python2.4/site-packages/psycopg2 and i had
> also
> > moved the adapter to the
> > instance/client1/Products folder, but still it is giving me the version
> > mismatch error. Also i checked the psycopg* in my system but
> > over there also i can see that it is correct version that has been
> installed
> > /usr/lib/python2.4/site-packages/psycopg2 .
> >
> > Regards,
> > Amir
> >
> > tlc2
> >
> > On Tue, Jun 23, 2009 at 3:41 PM, Thomas Bennett <bennetttm[at]appstate.edu
> >wrote:
> >
> >> Have you installed psycopg2 2.0.11, not the adapter but the library for
> >> python? and is it in the python path for your Zope python?
> >>
> >> I'm thinking you have psycopg not psycopg2 installed as your python
> library
> >> and the psycopg2 adapter. There is no psycopg 2.0.11.
> >>
> >> I am assuming this is still how psycopg is installed, the library and
> the
> >> DA
> >> product.
> >>
> >> http://initd.org/pub/software/psycopg/
> >>
> >>
> >> Thomas
> >>
> >>
> >>
> >> On Tuesday 23 June 2009 16:06:03 Amir wrote:
> >>> Hi,
> >>> I have (Zope 2.9.4-final, python 2.4.3, linux2) and I have used
> >>> psycopg2.0.11 adapter to connect Zope to Postgresql but I am getting
> this
> >>> error when I try to add the connection object the error is :-
> >>>
> >>> Error Type: ImportError
> >>>
> >>> Error Value: psycopg version mismatch (imported 2.0.11 (dt dec ext
> pq3))
> >>>
> >>> while the event log traceback shows that :-
> >>>
> >>> 2009-06-23T10:55:49 ERROR Shared.DC.ZRDB.Connection Error connecting to
> >>> relational database.
> >>> Traceback (most recent call last):
> >>> File "/opt/Plone-2.5/lib/python/Shared/DC/ZRDB/Connection.py", line
> 71,
> >>> in __setstate__
> >>> try: self.connect(self.connection_string)
> >>> File "/opt/Plone-2.5/zeocluster/client1/Products/ZPsycopgDA/DA.py",
> >> line
> >>> 120, in connect
> >>> raise ImportError("psycopg version mismatch (imported %s)" %
> >>> ImportError: psycopg version mismatch (imported 2.0.11 (dt dec ext
> pq3))
> >>>
> >>> I would appreciate for an answer asap.
> >>>
> >>> Thanks
> >>> Amir
> >>>
> >>> tlc2
> >>>
> >>> ***
> >>> *
> >> --
> >> Normally I'm against big things,
> >> I think the world is going to be saved by millions of small things.
> >> Too many things can go wrong when they get big.
> >> - Pete Seeger at his 90th birthday party Sunday May 3, 2009
> >>
> >> ==========================================
> >> Thomas McMillan Grant Bennett Appalachian State University
> >> Operations & Systems Analyst P O Box 32026
> >> University Library Boone, North Carolina
> >> 28608
> >> (828) 262 6587
> >>
> >> Library Systems Help Desk: https://www.library.appstate.edu/help/
> >> ==========================================
> >> _______________________________________________
> >> Zope maillist - Zope[at]zope.org
> >> http://mail.zope.org/mailman/listinfo/zope
> >> ** No cross posts or HTML encoding! **
> >> (Related lists -
> >> http://mail.zope.org/mailman/listinfo/zope-announce
> >> http://mail.zope.org/mailman/listinfo/zope-dev )
> >>
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Zope maillist - Zope[at]zope.org
> > http://mail.zope.org/mailman/listinfo/zope
> > ** No cross posts or HTML encoding! **
> > (Related lists -
> > http://mail.zope.org/mailman/listinfo/zope-announce
> > http://mail.zope.org/mailman/listinfo/zope-dev )
>
> _______________________________________________
> Zope maillist - Zope[at]zope.org
> http://mail.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )
>


rwoodhouse at wirelessmeasurement

Jun 24, 2009, 9:36 AM

Post #6 of 10 (1047 views)
Permalink
Re: psycopg import error [In reply to]

Ok, look at the error message again. It says

raise ImportError("psycopg version mismatch (imported %s)" %
ImportError: psycopg version mismatch (imported 2.0.11 (dt dec ext pq3))

so the version being reported back is '2.0.11 (dt dec ext pq3)' not '2.0.11'

Rowan

Amir wrote:
> Things that i have noticed
>
> 1)running and importing psycopg2
>
> gives this error
>
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> File "/usr/lib/python2.4/site-packages/psycopg2/__init__.py", line 60, in
> ?
> from _psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
> ImportError: /usr/lib/python2.4/site-packages/psycopg2/_psycopg.so:
> undefined symbol: PyUnicodeUCS2_Decode
>
> 2) for some reason in the Python-2.4.3/lib/python2.4/site-packages/psycopg2
> it has psycopg1.py so when i open it, it
> says in order to import do:- "from psycopg2 import psycopg1 as psycopg"(also
> says to run in psycopg1.1.x compatible mode) and if i do import it this way
> it gives me this error
>
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> File "/usr/lib/python2.4/site-packages/psycopg2/__init__.py", line 55, in
> ?
> from psycopg2 import tz
> ImportError: cannot import name tz
>
> I am thinking there is something in 2) is this normal?
>
>
>
> ps : 2.0.11 is in the allowed psycopg ALLOWED_PSYCOPG_VERSIONS =
> ('2.0.7','2.0.8','2.0.9','2.0.10', '2.0.11')
>
>
> Regards,
> Amir
>
> tlc2
>
> On Wed, Jun 24, 2009 at 10:56 AM, Rowan Woodhouse <
> rwoodhouse[at]wirelessmeasurement.com> wrote:
>
>> I had the same problem but found that if I just modified the list of
>> acceptable psycopg versions everything worked fine.
>>
>> Rowan
>>
>> Amir wrote:
>>> Hey,
>>> yes i have it installed at
>>> instance/Python-2.4.3/lib/python2.4/site-packages/psycopg2 and i had
>> also
>>> moved the adapter to the
>>> instance/client1/Products folder, but still it is giving me the version
>>> mismatch error. Also i checked the psycopg* in my system but
>>> over there also i can see that it is correct version that has been
>> installed
>>> /usr/lib/python2.4/site-packages/psycopg2 .
>>>
>>> Regards,
>>> Amir
>>>
>>> tlc2
>>>
>>> On Tue, Jun 23, 2009 at 3:41 PM, Thomas Bennett <bennetttm[at]appstate.edu
>>> wrote:
>>>
>>>> Have you installed psycopg2 2.0.11, not the adapter but the library for
>>>> python? and is it in the python path for your Zope python?
>>>>
>>>> I'm thinking you have psycopg not psycopg2 installed as your python
>> library
>>>> and the psycopg2 adapter. There is no psycopg 2.0.11.
>>>>
>>>> I am assuming this is still how psycopg is installed, the library and
>> the
>>>> DA
>>>> product.
>>>>
>>>> http://initd.org/pub/software/psycopg/
>>>>
>>>>
>>>> Thomas
>>>>
>>>>
>>>>
>>>> On Tuesday 23 June 2009 16:06:03 Amir wrote:
>>>>> Hi,
>>>>> I have (Zope 2.9.4-final, python 2.4.3, linux2) and I have used
>>>>> psycopg2.0.11 adapter to connect Zope to Postgresql but I am getting
>> this
>>>>> error when I try to add the connection object the error is :-
>>>>>
>>>>> Error Type: ImportError
>>>>>
>>>>> Error Value: psycopg version mismatch (imported 2.0.11 (dt dec ext
>> pq3))
>>>>> while the event log traceback shows that :-
>>>>>
>>>>> 2009-06-23T10:55:49 ERROR Shared.DC.ZRDB.Connection Error connecting to
>>>>> relational database.
>>>>> Traceback (most recent call last):
>>>>> File "/opt/Plone-2.5/lib/python/Shared/DC/ZRDB/Connection.py", line
>> 71,
>>>>> in __setstate__
>>>>> try: self.connect(self.connection_string)
>>>>> File "/opt/Plone-2.5/zeocluster/client1/Products/ZPsycopgDA/DA.py",
>>>> line
>>>>> 120, in connect
>>>>> raise ImportError("psycopg version mismatch (imported %s)" %
>>>>> ImportError: psycopg version mismatch (imported 2.0.11 (dt dec ext
>> pq3))
>>>>> I would appreciate for an answer asap.
>>>>>
>>>>> Thanks
>>>>> Amir
>>>>>
>>>>> tlc2
>>>>>
>>>>> ***
>>>>> *
>>>> --
>>>> Normally I'm against big things,
>>>> I think the world is going to be saved by millions of small things.
>>>> Too many things can go wrong when they get big.
>>>> - Pete Seeger at his 90th birthday party Sunday May 3, 2009
>>>>
>>>> ==========================================
>>>> Thomas McMillan Grant Bennett Appalachian State University
>>>> Operations & Systems Analyst P O Box 32026
>>>> University Library Boone, North Carolina
>>>> 28608
>>>> (828) 262 6587
>>>>
>>>> Library Systems Help Desk: https://www.library.appstate.edu/help/
>>>> ==========================================
>>>> _______________________________________________
>>>> Zope maillist - Zope[at]zope.org
>>>> http://mail.zope.org/mailman/listinfo/zope
>>>> ** No cross posts or HTML encoding! **
>>>> (Related lists -
>>>> http://mail.zope.org/mailman/listinfo/zope-announce
>>>> http://mail.zope.org/mailman/listinfo/zope-dev )
>>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> Zope maillist - Zope[at]zope.org
>>> http://mail.zope.org/mailman/listinfo/zope
>>> ** No cross posts or HTML encoding! **
>>> (Related lists -
>>> http://mail.zope.org/mailman/listinfo/zope-announce
>>> http://mail.zope.org/mailman/listinfo/zope-dev )
>> _______________________________________________
>> Zope maillist - Zope[at]zope.org
>> http://mail.zope.org/mailman/listinfo/zope
>> ** No cross posts or HTML encoding! **
>> (Related lists -
>> http://mail.zope.org/mailman/listinfo/zope-announce
>> http://mail.zope.org/mailman/listinfo/zope-dev )
>>
>

_______________________________________________
Zope maillist - Zope[at]zope.org
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )


fixer.solver at gmail

Jun 24, 2009, 9:43 AM

Post #7 of 10 (1044 views)
Permalink
Re: psycopg import error [In reply to]

so I was able to fix instance/Python-2.4.3/bin/python errors that I was
getting by editing the psycopg1.py file and changing the following statement
:-

import _psycopg as _2psycopg

to

import _2psycopg

now I am able to import psycopg2 @ zope python level but not yet on zope
because when I add the connection object it gives the same mismatch version
error.

Regards,
Amir

tlc2



On Wed, Jun 24, 2009 at 11:23 AM, Amir <fixer.solver[at]gmail.com> wrote:

> Things that i have noticed
>
> 1)running and importing psycopg2
>
> gives this error
>
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> File "/usr/lib/python2.4/site-packages/psycopg2/__init__.py", line 60, in
> ?
> from _psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
> ImportError: /usr/lib/python2.4/site-packages/psycopg2/_psycopg.so:
> undefined symbol: PyUnicodeUCS2_Decode
>
> 2) for some reason in the Python-2.4.3/lib/python2.4/site-packages/psycopg2
> it has psycopg1.py so when i open it, it
> says in order to import do:- "from psycopg2 import psycopg1 as
> psycopg"(also says to run in psycopg1.1.x compatible mode) and if i do
> import it this way it gives me this error
>
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> File "/usr/lib/python2.4/site-packages/psycopg2/__init__.py", line 55, in
> ?
> from psycopg2 import tz
> ImportError: cannot import name tz
>
> I am thinking there is something in 2) is this normal?
>
>
>
> ps : 2.0.11 is in the allowed psycopg ALLOWED_PSYCOPG_VERSIONS =
> ('2.0.7','2.0.8','2.0.9','2.0.10', '2.0.11')
>
>
> Regards,
> Amir
>
> tlc2
>
>
> On Wed, Jun 24, 2009 at 10:56 AM, Rowan Woodhouse <
> rwoodhouse[at]wirelessmeasurement.com> wrote:
>
>> I had the same problem but found that if I just modified the list of
>> acceptable psycopg versions everything worked fine.
>>
>> Rowan
>>
>> Amir wrote:
>> > Hey,
>> > yes i have it installed at
>> > instance/Python-2.4.3/lib/python2.4/site-packages/psycopg2 and i had
>> also
>> > moved the adapter to the
>> > instance/client1/Products folder, but still it is giving me the version
>> > mismatch error. Also i checked the psycopg* in my system but
>> > over there also i can see that it is correct version that has been
>> installed
>> > /usr/lib/python2.4/site-packages/psycopg2 .
>> >
>> > Regards,
>> > Amir
>> >
>> > tlc2
>> >
>> > On Tue, Jun 23, 2009 at 3:41 PM, Thomas Bennett <bennetttm[at]appstate.edu
>> >wrote:
>> >
>> >> Have you installed psycopg2 2.0.11, not the adapter but the library for
>> >> python? and is it in the python path for your Zope python?
>> >>
>> >> I'm thinking you have psycopg not psycopg2 installed as your python
>> library
>> >> and the psycopg2 adapter. There is no psycopg 2.0.11.
>> >>
>> >> I am assuming this is still how psycopg is installed, the library and
>> the
>> >> DA
>> >> product.
>> >>
>> >> http://initd.org/pub/software/psycopg/
>> >>
>> >>
>> >> Thomas
>> >>
>> >>
>> >>
>> >> On Tuesday 23 June 2009 16:06:03 Amir wrote:
>> >>> Hi,
>> >>> I have (Zope 2.9.4-final, python 2.4.3, linux2) and I have used
>> >>> psycopg2.0.11 adapter to connect Zope to Postgresql but I am getting
>> this
>> >>> error when I try to add the connection object the error is :-
>> >>>
>> >>> Error Type: ImportError
>> >>>
>> >>> Error Value: psycopg version mismatch (imported 2.0.11 (dt dec ext
>> pq3))
>> >>>
>> >>> while the event log traceback shows that :-
>> >>>
>> >>> 2009-06-23T10:55:49 ERROR Shared.DC.ZRDB.Connection Error connecting
>> to
>> >>> relational database.
>> >>> Traceback (most recent call last):
>> >>> File "/opt/Plone-2.5/lib/python/Shared/DC/ZRDB/Connection.py", line
>> 71,
>> >>> in __setstate__
>> >>> try: self.connect(self.connection_string)
>> >>> File "/opt/Plone-2.5/zeocluster/client1/Products/ZPsycopgDA/DA.py",
>> >> line
>> >>> 120, in connect
>> >>> raise ImportError("psycopg version mismatch (imported %s)" %
>> >>> ImportError: psycopg version mismatch (imported 2.0.11 (dt dec ext
>> pq3))
>> >>>
>> >>> I would appreciate for an answer asap.
>> >>>
>> >>> Thanks
>> >>> Amir
>> >>>
>> >>> tlc2
>> >>>
>> >>> ***
>> >>> *
>> >> --
>> >> Normally I'm against big things,
>> >> I think the world is going to be saved by millions of small things.
>> >> Too many things can go wrong when they get big.
>> >> - Pete Seeger at his 90th birthday party Sunday May 3, 2009
>> >>
>> >> ==========================================
>> >> Thomas McMillan Grant Bennett Appalachian State University
>> >> Operations & Systems Analyst P O Box 32026
>> >> University Library Boone, North Carolina
>> >> 28608
>> >> (828) 262 6587
>> >>
>> >> Library Systems Help Desk: https://www.library.appstate.edu/help/
>> >> ==========================================
>> >> _______________________________________________
>> >> Zope maillist - Zope[at]zope.org
>> >> http://mail.zope.org/mailman/listinfo/zope
>> >> ** No cross posts or HTML encoding! **
>> >> (Related lists -
>> >> http://mail.zope.org/mailman/listinfo/zope-announce
>> >> http://mail.zope.org/mailman/listinfo/zope-dev )
>> >>
>> >
>> >
>> > ------------------------------------------------------------------------
>> >
>> > _______________________________________________
>> > Zope maillist - Zope[at]zope.org
>> > http://mail.zope.org/mailman/listinfo/zope
>> > ** No cross posts or HTML encoding! **
>> > (Related lists -
>> > http://mail.zope.org/mailman/listinfo/zope-announce
>> > http://mail.zope.org/mailman/listinfo/zope-dev )
>>
>> _______________________________________________
>> Zope maillist - Zope[at]zope.org
>> http://mail.zope.org/mailman/listinfo/zope
>> ** No cross posts or HTML encoding! **
>> (Related lists -
>> http://mail.zope.org/mailman/listinfo/zope-announce
>> http://mail.zope.org/mailman/listinfo/zope-dev )
>>
>
>


bennetttm at appstate

Jun 24, 2009, 10:17 AM

Post #8 of 10 (1045 views)
Permalink
Re: psycopg import error [In reply to]

looks like DA.py is using psycopg2.__version__ not psycopg2.__version__[:5]
with the index of 5. You might want to check that. Also,
psycopg2.__version__[:5] is 2.0.1 not 2.0.11 and 2.0.1 is not in the list on
my install from today. The index should be 6 not 5 for versions higher than
2.0.9 .

On my machine with python 2.5.2
>> import psycopg2
>>> psycopg2.__version__[:5]
'2.0.1'
>>> psycopg2.__version__
'2.0.11 (dt dec ext pq3)'

You might want to undo all of your changes and change the index to 6. If this
is the case let me know and I will send a bug report to the author.

Thomas




On Tuesday 23 June 2009 16:06:03 Amir wrote:
> Hi,
> I have (Zope 2.9.4-final, python 2.4.3, linux2) and I have used
> psycopg2.0.11 adapter to connect Zope to Postgresql but I am getting this
> error when I try to add the connection object the error is :-
>
> Error Type: ImportError
>
> Error Value: psycopg version mismatch (imported 2.0.11 (dt dec ext pq3))
>
> while the event log traceback shows that :-
>
> 2009-06-23T10:55:49 ERROR Shared.DC.ZRDB.Connection Error connecting to
> relational database.
> Traceback (most recent call last):
> File "/opt/Plone-2.5/lib/python/Shared/DC/ZRDB/Connection.py", line 71,
> in __setstate__
> try: self.connect(self.connection_string)
> File "/opt/Plone-2.5/zeocluster/client1/Products/ZPsycopgDA/DA.py", line
> 120, in connect
> raise ImportError("psycopg version mismatch (imported %s)" %
> ImportError: psycopg version mismatch (imported 2.0.11 (dt dec ext pq3))
>
> I would appreciate for an answer asap.
>
> Thanks
> Amir
>
> tlc2
>
> ***
> *

--
Normally I'm against big things,
I think the world is going to be saved by millions of small things.
Too many things can go wrong when they get big.
- Pete Seeger at his 90th birthday party Sunday May 3, 2009

==========================================
Thomas McMillan Grant Bennett Appalachian State University
Operations & Systems Analyst P O Box 32026
University Library Boone, North Carolina 28608
(828) 262 6587

Library Systems Help Desk: https://www.library.appstate.edu/help/
==========================================
_______________________________________________
Zope maillist - Zope[at]zope.org
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )


Thomas.OConnor at newcastle

Jul 1, 2009, 6:51 PM

Post #9 of 10 (889 views)
Permalink
Re: psycopg import error [In reply to]

Hi,

I also experienced the problem this morning when trying to use the product ZPsycopgDA version 2.0.11 on Zope. The error reported by Plone/Zope is:

Error Value: psycopg version mismatch (imported 2.0.11 (dt dec ext pq3))

Due to the fact it is extracting the first 5 characters (2.0.1) and comparing it to the full version (2.0.11), thus failing.

Instead of changing the index to 6 (which would then break 2.0.8 versions, etc.), you can explode the string by spaces, then extract the first part:

so the only change would be to line 119 of DA.py, from:
if psycopg2.__version__[:5] not in ALLOWED_PSYCOPG_VERSIONS:

to:
if psycopg2.__version__.split(' ')[0] not in ALLOWED_PSYCOPG_VERSIONS:

No other changes to the versions definition would be required.

This will be both backwards and forwards compatible with all versions from 0.0.0 to 999.999.999 (well, infinity really)!

Keep up the good work.

Cheers,

Tom

--
Thomas O'Connor
Web developer

(02) 498 54130
Thomas.OConnor[at]newcastle.edu.au

Office of IT Services
Bar on the Hill Building
UoN Services Limited
University Drive
Callaghan NSW 2308
_______________________________________________
Zope maillist - Zope[at]zope.org
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )


fixer.solver at gmail

Jul 2, 2009, 1:31 PM

Post #10 of 10 (875 views)
Permalink
Re: psycopg import error [In reply to]

Hey,
I finally reverted all the changes and fixed it like you said editing
the DA.py in ZPsycoDA. thought i let you know about it. through this

if psycopg2.__version__[:6] not in ALLOWED_PSYCOPG_VERSIONS:

and then

if psycopg2.__version__.split(' ')[0] not in ALLOWED_PSYCOPG_VERSIONS:

ps: in changelog it shows that changes have been done by the author on
2009-05-19. but doesn't say which version.


Thanks
Amir

Tlc2

On Wed, Jul 1, 2009 at 8:51 PM, Thomas OConnor <
Thomas.OConnor[at]newcastle.edu.au> wrote:

> Hi,
>
> I also experienced the problem this morning when trying to use the product
> ZPsycopgDA version 2.0.11 on Zope. The error reported by Plone/Zope is:
>
> Error Value: psycopg version mismatch (imported 2.0.11 (dt dec ext pq3))
>
> Due to the fact it is extracting the first 5 characters (2.0.1) and
> comparing it to the full version (2.0.11), thus failing.
>
> Instead of changing the index to 6 (which would then break 2.0.8 versions,
> etc.), you can explode the string by spaces, then extract the first part:
>
> so the only change would be to line 119 of DA.py, from:
> if psycopg2.__version__[:5] not in ALLOWED_PSYCOPG_VERSIONS:
>
> to:
> if psycopg2.__version__.split(' ')[0] not in
> ALLOWED_PSYCOPG_VERSIONS:
>
> No other changes to the versions definition would be required.
>
> This will be both backwards and forwards compatible with all versions from
> 0.0.0 to 999.999.999 (well, infinity really)!
>
> Keep up the good work.
>
> Cheers,
>
> Tom
>
> --
> Thomas O'Connor
> Web developer
>
> (02) 498 54130
> Thomas.OConnor[at]newcastle.edu.au
>
> Office of IT Services
> Bar on the Hill Building
> UoN Services Limited
> University Drive
> Callaghan NSW 2308
> _______________________________________________
> Zope maillist - Zope[at]zope.org
> http://mail.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )
>

Zope users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.