[PyQt] Determining location of pyqtdeployed app at runtime

Phil Thompson phil at riverbankcomputing.com
Sat Aug 2 08:58:38 BST 2014


On 02/08/2014 7:37 am, Dave Gradwell wrote:
> Hm, odd, I'm on v0.5.
> 
> Interpreted:
> admins-Mac-2:~ admin$ python3.4
> /Users/admin/Desktop/clientUtility/clientUtility.py 
> QtCore.QFileInfo(__file__).absolutePath() --->
> /Users/admin/Desktop/clientUtility
> 
> Pyqtdeployed:
> admins-Mac-2:~ admin$
> /Users/admin/Desktop/clientUtility/build/clientUtility.app/Contents/MacOS/clientUtility
> QtCore.QFileInfo(__file__).absolutePath() ---> /Users/admin

It should start with ':/'.

I'm saying it *should* work, which is not quite the same as it *does* 
work.

Before the next release I will be able to pyqtdeploy pyqtdeploy so that 
should flush out any bug.

> Okay, I'll hack it for now with:
> try:
>     import pyqtdeploy
>     PATH_TO_ICONS = os.path.dirname(sys.executable) + "/icons/"
> except ImportError:
>     PATH_TO_ICONS = QtCore.QFileInfo(__file__).absolutePath() + 
> "/icons/"
> ... or something.

A heads up - the pyqtdeploy module will be renamed to pdytools.

Phil


More information about the PyQt mailing list