• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Cocoa Python broken in Leopard??
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa Python broken in Leopard??


  • Subject: Re: Cocoa Python broken in Leopard??
  • From: Bill Bumgarner <email@hidden>
  • Date: Tue, 6 Nov 2007 23:58:29 -0800

On Nov 6, 2007, at 11:49 PM, Uliano Guerrini wrote:
with every Xcode project template involving Python it is enough to add an

import Quartz

to any python file to hang the application with the icon jumping in the dock.
From logs on the console it seems that the application isn't able to connect to the window server
.... error messages deleted ....

Python's "import" works quite a bit differently than Objective-C's #import. Namely, it will execute any code found in the imported modules that appears within the module's scope.

The Quartz module requires a viable window server connection to be set up. If you import Quartz in main.py or at the top level of your application delegate source file (or anywhere that is imported as a part of the app launching process prior to control being passed to the appkit), it'll blow up as you have seen.

Instead, import Quartz in response to application initialization. I dropped "import Quartz" into the standard Cocoa Python Application's applicationDidFinishLaunching_() method and it no longer bombs (I didn't test much further than that):

class FoobarAppDelegate(NSObject):
    def applicationDidFinishLaunching_(self, sender):
        import Quartz
        NSLog("Application did finish launching.")

b.bum

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Cocoa Python broken in Leopard??
      • From: Uliano Guerrini <email@hidden>
References: 
 >Cocoa Python broken in Leopard?? (From: Uliano Guerrini <email@hidden>)

  • Prev by Date: Cocoa Python broken in Leopard??
  • Next by Date: Re: Cocoa Python broken in Leopard??
  • Previous by thread: Cocoa Python broken in Leopard??
  • Next by thread: Re: Cocoa Python broken in Leopard??
  • Index(es):
    • Date
    • Thread