Hi Glenn,

You are right!

There should be documentation for this. I have been scouring the web for a 
solution to this. Turns out, the documentation is outdated and PyInstaller can 
handle PyObjC just fine. It’s just that the namespace doubles up. 

When I converted my NSObject call from:

import AppKit

class NsObjCApp(AppKit.NSObject)
…

 to:

import AppKit

class NsObjCApp(AppKit.AppKit.NSObject)
…

it worked perfectly.

Thank you!

Best,
Burak



On November 11, 2013 at 8:28:26 PM, Glenn Ramsey ([email protected]) wrote:

Hi Burak,  

On 12/11/13 01:04, Martin Zibricky wrote:  
> On Sunday 10 of November 2013 11:13:44 [email protected] wrote:  
>> So I'm stuck here. Clicking on dock is a rather important UI action that I  
>> want to provide to my users, so I have to work with PyObjC somehow.  
>>  
>> Any directions?  
>  
> Examine how if PyObjc does any import magic that pyinstaller is not able to  
> handle or any data files or necessary initialization.  
>  

I noticed a similar behaviour and my workaround is below. It's for the  
Foundataion namespace, but it is possible that the AppKit namespace has a  
similar issue. I figured out the namespaces by trial and error using variations 
on:  

import namespace  
print dir(namespace)  

in a packaged script.  

If you figure out what is causing this behavior I'd like to know.  

Glenn  


Example of workaround:  

import sys  
import Foundation  

def main():  

if getattr(sys, 'frozen', False):  
# packaged  
print "Foundation.Foundation.NSFullUserName:",\  
Foundation.Foundation.NSFullUserName()  
loc = Foundation.CoreFoundation.CoreFoundation.CFLocaleCopyCurrent()  
countryCode = Foundation.CoreFoundation.CoreFoundation.CFLocaleGetValue(  
loc,  
Foundation.CoreFoundation.CoreFoundation.kCFLocaleCountryCode)  
countryName =  
Foundation.CoreFoundation.CoreFoundation.CFLocaleCopyDisplayNameForPropertyValue(
  
loc,  
Foundation.CoreFoundation.CoreFoundation.kCFLocaleCountryCode,  
countryCode)  
else:  
# non packaged  
print "Foundation.NSFullUserName:",\  
Foundation.NSFullUserName()  
loc = Foundation.CFLocaleCopyCurrent()  
countryCode = Foundation.CFLocaleGetValue(  
loc,  
Foundation.kCFLocaleCountryCode)  
countryName = Foundation.CFLocaleCopyDisplayNameForPropertyValue(  
loc, Foundation.kCFLocaleCountryCode, countryCode)  
print countryName, countryCode  

if __name__=="__main__":  
main()  

--  
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.  
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].  
To post to this group, send email to [email protected].  
Visit this group at http://groups.google.com/group/pyinstaller.  
For more options, visit https://groups.google.com/groups/opt_out.  

-- 
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyinstaller.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to