Re: Import error using psycopg2 with py2exe

Mike Burke <[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
Thank you very much for your quick reply, however that file did not do
the trick.

I found the problem.  My build system is Vista and the target system
was Win2k.  There are 2 DLLs that are required by pyscopg.pyd
(secur32.dll & shfolder.dll) that are OS dependent.  Apparently py2exe
does not recognize these files as belonging to the OS and it copies
them to the dist folder.  The OS will try to load the dll in the
install path before the ones in system32 and when it cannot load the
newer versions it throws the error below.

The immediate solution was to just rename or remove these 2 files from
the dist folder to allow the system to use the versions installed in
the OS.  I am only doing limited distribuition to a few internal
clients so this is good enough for me.  If you were to more widely
distribute the files adding an exclusion for these files in the setup
script for py2exe should fix this issue.

Thanks,

Mike


On Wed, May 20, 2009 at 5:08 PM, Tim Roberts <[email protected]> wrote:
> Mike Burke wrote:
>> Python 2.6.2
>> Psycopg2.0.10 (also used 2.0.9)
>> Py2Exe 0.6.9
>> OS: Vista Business
>>
>> I made a simple one line script that contains only a single import
>> line for psycopg2.  The script runs fine under straight python and
>> after convert to exe on my development maching, however after the
>> files are copied to some other machine I get the following error:
>>
>> Traceback (most recent call last):
>>   File "test1.py", line 2, in <module>
>>   File "psycopg2\__init__.pyc", line 60, in <module>
>>   File "psycopg2\_psycopg.pyc", line 12, in <module>
>>   File "psycopg2\_psycopg.pyc", line 10, in __load
>> ImportError: DLL load failed: The specified procedure could not be found.
>>
>> There was somebody that posted the same problem on the list a long
>> time ago and he never received any answer.
>>
>> Does anybody know a solution or where I should start to look to
>> isolate the error
>
> When py2exe was searching for DLLs and modules, did it include
> libpq.dll?  You need that.  If it didn't find it, you might need to add
> it to your setup script.
>
> --
> Tim Roberts, [email protected]
> Providenza & Boekelheide, Inc.
>
> _______________________________________________
> Psycopg mailing list
> Psycopg-IAPFreCvJWPBWskQ1e/[email protected]
> http://lists.initd.org/mailman/listinfo/psycopg
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.