`from QTKit import *` causes a 'FAILED TO establish the default connection to the WindowServer' in PyObjC application

StackOverflow https://stackoverflow.com/questions/1733098

  •  20-09-2019
  •  | 
  •  

Question

I've been trying out PyObjC and I can't seem to get the QTKit imports to work. If I import QTKit like so: from QTKit import * I get a flood of errors:

[Session started at 2009-11-13 21:03:49 -0600.]
_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.
2009-11-13 21:03:50.671 WhyDoesntThisWork[16550:10b] *** -[NSRecursiveLock unlock]: lock (<NSRecursiveLock: 0x1c55c00> '(null)') unlocked when not locked
2009-11-13 21:03:50.673 WhyDoesntThisWork[16550:10b] *** Break on _NSLockError() to debug.
2009-11-13 21:03:50.673 WhyDoesntThisWork[16550:10b] *** -[NSRecursiveLock unlock]: lock (<NSRecursiveLock: 0x1c55c00> '(null)') unlocked when not locked
2009-11-13 21:03:50.674 WhyDoesntThisWork[16550:10b] *** Break on _NSLockError() to debug.
2009-11-13 21:03:50.681 WhyDoesntThisWork[16550:10b] *** -[NSRecursiveLock unlock]: lock (<NSRecursiveLock: 0x1c55c00> '(null)') unlocked when not locked
2009-11-13 21:03:50.682 WhyDoesntThisWork[16550:10b] *** Break on _NSLockError() to debug.
2009-11-13 21:03:50.692 WhyDoesntThisWork[16550:10b] NSInternalInconsistencyException - Error (1002) creating CGSWindow
2009-11-13 21:03:50.704 WhyDoesntThisWork[16550:10b] *** -[NSRecursiveLock unlock]: lock (<NSRecursiveLock: 0x1c55c00> '(null)') unlocked when not locked
2009-11-13 21:03:50.705 WhyDoesntThisWork[16550:10b] *** Break on _NSLockError() to debug.
2009-11-13 21:03:50.712 WhyDoesntThisWork[16550:10b] *** -[NSRecursiveLock unlock]: lock (<NSRecursiveLock: 0x1c55c00> '(null)') unlocked when not locked
2009-11-13 21:03:50.713 WhyDoesntThisWork[16550:10b] *** Break on _NSLockError() to debug.
2009-11-13 21:03:50.721 WhyDoesntThisWork[16550:10b] *** -[NSRecursiveLock unlock]: lock (<NSRecursiveLock: 0x1c55c00> '(null)') unlocked when not locked
2009-11-13 21:03:50.721 WhyDoesntThisWork[16550:10b] *** Break on _NSLockError() to debug.
2009-11-13 21:03:50.722 WhyDoesntThisWork[16550:10b] *** -[NSRecursiveLock unlock]: lock (<NSRecursiveLock: 0x1c55c00> '(null)') unlocked when not locked
2009-11-13 21:03:50.723 WhyDoesntThisWork[16550:10b] *** Break on _NSLockError() to debug.

This happens even with no other code added to the application. For example: I can create a new cocoa/python project, add the Quicktime framework, open the generated delegate and add the line from QTKit import * , build and run and the errors flow. Is there a step I'm missing?

Was it helpful?

Solution

Take a look at this tutorial. Apparently QTKit cannot be imported until after the runloop has been established.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top