[PyQt] fail to load libqcocoa.dylib on sandboxed OSX PyQt app

lloyd konneker bootch at nc.rr.com
Thu Jun 5 16:26:59 BST 2014


I have built a sandboxed PyQt app on OSX (pyqtdeploy, convert to Xcode 
proj, macdeployqt inside Xcode, ...Product>Archive). That all seems to 
work: the bundle is complete and includes an appropriate qt.conf (and is 
sandboxed and codesigned.)

But I think I also need to have a preamble to my app to addLibraryPath() 
to plugins:

def _appBundlePluginPath():
   '''
   path to plugin component of OSX app's bundle
   or None
   '''
   # use Python os, class method QCoreApplication.applicationDirPath() 
cannot be used until QCoreApplication is instantiated?
   appPath = _appBundlePath()
   # Typically "APP_DIR/Contents/MacOS" on OSX.
   # else is path that usually does not have a Plugins sub dir
   appDir = QDir(appPath)
   if not appDir.cdUp():
     logAlert("Failed cdUp from appDir")
   # assert like ../Contents
   if appDir.cd("PlugIns"):
     result = appDir.absolutePath()
     # assert like ../Contents/PlugIns
   else:
     result = None
   return result

def _appBundlePath():
   '''
   This returns a strange path for sandboxed apps '.../:/...'.
   I don't understand what the colon means
   '''
   return os.path.dirname(os.path.abspath( __file__ ))

But the cdUp() fails because of the colon in the strange path?

Should I give up and link libqcocoa statically (I am loathe to build Qt 
on OSX) or  is there some way to get a proper path to plugins in the 
sandbox?

(Or is addLibraryPath() even necessary, does Qt read qt.conf first and 
is it working on sandboxed apps?)

(Is the strange path related to chroot, can I somehow fabricate an 
absolute path to the plugins directory, and will sandboxing let Qt 
access it?)


More information about the PyQt mailing list