[PyQt] application.py of PyQt5 examples improvement suggestion

Florian Bruhin me at the-compiler.org
Tue Jan 20 05:52:14 GMT 2015


* iMath <2281570025 at qq.com> [2015-01-20 13:13:57 +0800]:
> C:\Python34\Lib\site-packages\PyQt5\examples\mainwindows\application\application.py
> 
> 
> change code in line 113        
>    
> root = QFileInfo(__file__).absolutePath()
> 
> 
> to
> #############################
> import os
> root = os.getcwd()
> 
> 
> #############################
> 
> 
> 
> 
> if not,when freezed into executable by cx_Freeze,it will not work for "__file__ is not defined".

I've not looked at that code, but generally that's not the same thing.

The first is the path the file is at, the second is your current
working directory.

They MAY be the same, but then that's luck.

Florian

-- 
http://www.the-compiler.org | me at the-compiler.org (Mail/XMPP)
   GPG: 916E B0C8 FD55 A072 | http://the-compiler.org/pubkey.asc
         I love long mails! | http://email.is-not-s.ms/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20150120/63bd267d/attachment.sig>


More information about the PyQt mailing list