Py2App and PyQT

View: New views
10 Messages — Rating Filter:   Alert me  

Py2App and PyQT

by kelsolaar_fool :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,
 
Now that I have my application running and packaged on Windows and Linux, I'm trying to get it working under Mac Os X ( Leopard 10.5.5 ).
Everything seem to be fine on compilation  side, but when I launch my application I'm getting :
 
Traceback (most recent call last):
  File "/Volumes/sIBL/src/dist/sIBL_GUI.app/Contents/Resources/__boot__.py", line 137, in <module>
    _run('sIBL_GUI.py')
  File "/Volumes/sIBL/src/dist/sIBL_GUI.app/Contents/Resources/__boot__.py", line 134, in _run
    execfile(path, globals(), globals())
  File "/Volumes/sIBL/src/dist/sIBL_GUI.app/Contents/Resources/sIBL_GUI.py", line 71, in <module>
    from PyQt4.QtCore import *
  File "PyQt4/QtCore.pyc", line 18, in <module>
  File "PyQt4/QtCore.pyc", line 15, in __load
ImportError: '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload/PyQt4/QtCore.so' not found
2008-10-26 08:55:36.106 sIBL_GUI[432:10b] sIBL_GUI Error
2008-10-26 08:55:36.117 sIBL_GUI[432:10b] sIBL_GUI Error
An unexpected error has occurred during execution of the main script
 
ImportError: '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload/PyQt4/QtCore.so' not found
 
This is pretty strange because I actually found that the file is correctly included in "dist/sIBL_GUI.app/Contents/Resources/lib/python2.5/lib-dynload/PyQt4/" directory.
Anyone faced this or have an idea ?
 
Thanks,
 
Thomas

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@...
http://mail.python.org/mailman/listinfo/pythonmac-sig

Parent Message unknown Re: Py2App and PyQT

by kelsolaar_fool :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ok the QtCore.so problem got solved by adding this line into the __boot__.py :
 
sys.path = [os.path.join(os.environ['RESOURCEPATH'], 'lib', 'python2.5', 'lib-dynload')] + sys.path
 
Now I'm facing another really annoying problem : I need at some point to load jpeg images into my program and Qt jpeg support is done from a plugin library : libqjpeg.dylib under MacOsX and qjpeg4.dll on Windows.
On Windows in order to make my packaged program use it (compiling with py2exe) I include a qt.conf file at the root of my software with this as content :
 
[Paths]
Prefix = ./PyQt4
Binaries = .
 
and the dll is here : PyQt4\plugins\imageformats\qjpeg4.dll
 
This is working fine, I tried the same or a lot of different locations and combinations on MacOsX and everything failed, resulting in blank thumbnails in my program. That is really annoying and can really compromise the release of it on Mac. Hope someone as an idea ?
 
Thanx,
 
Thomas
 

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@...
http://mail.python.org/mailman/listinfo/pythonmac-sig

Re: Py2App and PyQT

by Eddie L :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I had the exact same problem and fixed it adding that line to the __boot__.py file in the app's package contents, but I was wondering if there was a way to tell py2app to do this automatically in the setup script because otherwise I'd have to do it manually every time I build my project. Py2exe has a custom boot script option but it doesn't look like py2app does.

Thanks,
Eddie

kelsolaar_fool wrote:
Ok the QtCore.so problem got solved by adding this line into the __boot__.py :

sys.path = [os.path.join(os.environ['RESOURCEPATH'], 'lib', 'python2.5', 'lib-dynload')] + sys.path

Re: Py2App and PyQT

by Christopher Barker :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Eddie L wrote:
> I had the exact same problem and fixed it adding that line to the __boot__.py
> file in the app's package contents, but I was wondering if there was a way
> to tell py2app to do this automatically in the setup script because
> otherwise I'd have to do it manually every time I build my project.

clearly a bad idea!

> Py2exe
> has a custom boot script option but it doesn't look like py2app does.

I haven't seen that option -- but you're right it should. Some quick
poking did not make it clear to me where py2app builds the __boot.__py
file though.

Anyway, you can always hack around this by adding some code to your
setup.py that changes __boot__.py after building the app.

I find I have to add a lot of extra fiddling code to accommodate eggs
and other deficiencies in py2app, but I don't have the time to get to
know py2app enough to submit a patch, so there you go.

-Chris




--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@...
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@...
http://mail.python.org/mailman/listinfo/pythonmac-sig

Re: Py2App and PyQT

by Eddie L :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Christopher Barker wrote:
Some quick poking did not make it clear to me where py2app builds the __boot.__py
file though.
If you create an app with py2app then right click on it and click show package contents then you can browse the app's contents. __boot__.py is located in Content/resources/__boot__.py.

Christopher Barker wrote:
Anyway, you can always hack around this by adding some code to your
setup.py that changes __boot__.py after building the app.
Yeah, I tried adding my custom __boot__.py to the data files since they were being stored in the same location but py2app still used it's own creation. Any ideas as to how I could change the file after it's been made? I'm new to py2app so just a point in the right direction would be very helpful.

-Eddie


Re: Py2App and PyQT

by Christopher Barker :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Eddie L wrote:

>
> Christopher Barker wrote:
>> Some quick poking did not make it clear to me where py2app builds the
>> __boot.__py
>> file though.
>>
>
> If you create an app with py2app then right click on it and click show
> package contents then you can browse the app's contents. __boot__.py is
> located in Content/resources/__boot__.py.

yes, I meant I have no idea where in the Py2app code, py2app actually
generates the __boot__.py file, so I can't see where to add a patch...


> Yeah, I tried adding my custom __boot__.py to the data files since they were
> being stored in the same location but py2app still used it's own creation.
> Any ideas as to how I could change the file after it's been made? I'm new to
> py2app so just a point in the right direction would be very helpful.

as you've seen, an app bundle is simply a directory with a special name
and structure -- Finder shows it in a special way, but you can
manipulate the files in it from the command line or a python script just
like you'd manipulate any files.

so, in your setup.py, after running setup(), you can add code that
either adds stuff to __boot__.py, or replaces it with another one --
whatever is easiest.

-Chris



--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@...
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@...
http://mail.python.org/mailman/listinfo/pythonmac-sig

Re: Py2App and PyQT

by Ronald Oussoren :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 
On Thursday, January 15, 2009, at 06:20PM, "Christopher Barker" <Chris.Barker@...> wrote:

>Eddie L wrote:
>>
>> Christopher Barker wrote:
>>> Some quick poking did not make it clear to me where py2app builds the
>>> __boot.__py
>>> file though.
>>>
>>
>> If you create an app with py2app then right click on it and click show
>> package contents then you can browse the app's contents. __boot__.py is
>> located in Content/resources/__boot__.py.
>
>yes, I meant I have no idea where in the Py2app code, py2app actually
>generates the __boot__.py file, so I can't see where to add a patch...

The file is generated by code in the module py2app.build_app, from fragments in py2app.bootstrap.

Ronald
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@...
http://mail.python.org/mailman/listinfo/pythonmac-sig

Re: Py2App and PyQT

by Eddie L :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ronald Oussoren wrote:
The file is generated by code in the module py2app.build_app, from fragments in py2app.bootstrap.
Thank you, that solved my problem. I went into the bootstrap folder and added the line into build_app.py, now it's always included in my apps

-Eddie

Re: Py2App and PyQT

by Christopher Barker :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ronald Oussoren wrote:
>  
> On Thursday, January 15, 2009, at 06:20PM, "Christopher Barker" <Chris.Barker@...> wrote:
>> Eddie L wrote:
>>> Christopher Barker wrote:

>> yes, I meant I have no idea where in the Py2app code, py2app actually
>> generates the __boot__.py file, so I can't see where to add a patch...
>
> The file is generated by code in the module py2app.build_app, from fragments in py2app.bootstrap.

Thanks Ronald. I've No time now, but perhaps it could be patched to load
a user-supplied boot file -- py2exe has this option, and it's quite handy.

-Chris



--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@...
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@...
http://mail.python.org/mailman/listinfo/pythonmac-sig

Building pyobjc

by Lists In@IDC :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Is there a way to rebuild pyobjc on Leopard using the XCode 3.1/gcc  
4.01 tools?

I have tried pulling the trunk and tagged r200-leopard builds of  
pyobjc from http://svn.red-bean.com/pyobjc and neither will build  
using the 02-develop-all.sh build file.

There are lots of C compiler errors starting with:

libffi-src/powerpc/ppc-ffi_darwin.c:41:67: error: libkern/
OSCacheControl.h: No such file or directory
libffi-src/powerpc/ppc-ffi_darwin.c:86: warning: no previous prototype  
for ‘ffi_prep_args’
libffi-src/powerpc/ppc-ffi_darwin.c: In function ‘ffi_prep_closure’:
libffi-src/powerpc/ppc-ffi_darwin.c:751: warning: implicit declaration  
of function ‘sys_icache_invalidate’
libffi-src/powerpc/ppc-ffi_darwin.c:751: warning: nested extern  
declaration of ‘sys_icache_invalidate’
libffi-src/powerpc/ppc-ffi_darwin.c: At top level:
libffi-src/powerpc/ppc-ffi_darwin.c:810: warning: no previous  
prototype for ‘ffi_closure_helper_DARWIN’
libffi-src/powerpc/ppc-ffi_darwin.c: In function  
‘ffi_closure_helper_DARWIN’:
libffi-src/powerpc/ppc-ffi_darwin.c:845: warning: comparison between  
signed and unsigned
libffi-src/powerpc/ppc-ffi_darwin.c:901: warning: pointer of type  
‘void *’ used in arithmetic
libffi-src/powerpc/ppc-ffi_darwin.c:901: warning: pointer of type  
‘void *’ used in arithmetic
lipo: can't figure out the architecture type of: /var/tmp//ccF5WZri.out
error: command 'gcc' failed with exit status 1

Then there's:

./02-develop-all.sh: line 15: cd: pyobjc-metadata: No such file or  
directory
/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/
Contents/MacOS/Python: can't open file 'setup.py': [Errno 2] No such  
file or directory
/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/
Contents/MacOS/Python: can't open file 'setup.py': [Errno 2] No such  
file or directory
error: Could not find suitable distribution for  
Requirement.parse('pyobjc-core>=2.0')
Modules/_Foundation_nscoder.m: In function  
‘imp_NSCoder_encodeArrayOfObjCType_count_at_’:
Modules/_Foundation_nscoder.m:220: error: ‘NSUInteger’ undeclared  
(first use in this function)
Modules/_Foundation_nscoder.m:220: error: (Each undeclared identifier  
is reported only once
Modules/_Foundation_nscoder.m:220: error: for each function it appears  
in.)
Modules/_Foundation_nscoder.m:220: error: syntax error before ‘count’

Way too many errors and what gets 'installed' doesn't link against an  
app at all.

Seems also to have trashed the one that was there, not sure there's a  
way to repair it short of a reinstall (DevTools or OS X install?).

Is there a checkout I'm missing or a trick to building pyobjc on  
Leopard from source?

Thanks,

S


_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@...
http://mail.python.org/mailman/listinfo/pythonmac-sig