I want to connect a python script with webkit on the commandline for
generating
images out of websites. This works fine for the normal MacOSX 10.5
version on my Mac
but not on the server variant.
Every time I call the script, the following error occur:
Wed May 28 15:41:47 micrositemaster Python[536] <Warning>: 3891612:
(connectAndCheck) Untrusted apps are not allowed to connect to or
launch Window Server before login.
_RegisterApplication(), FAILED TO establish the default connection
to the WindowServer, _CGSDefaultConnection() is NULL.
2008-05-28 15:41:47.998 Python[536:c13] *** -[NSRecursiveLock
unlock]: lock (<NSRecursiveLock: 0x1f1db60> '(null)') unlocked when
not locked
2008-05-28 15:41:47.998 Python[536:c13] *** Break on _NSLockError()
to debug.
Traceback (most recent call last):
File "picidae.py", line 391, in <module>
if __name__ == '__main__' : main()
File "picidae.py", line 372, in main
AppKit.NSBorderlessWindowMask, 2, 0)
objc.error: NSInternalInconsistencyException - Error (1002) creating
CGSWindow
Therefore I have googled for the problem and found a technote from
apple, where the describe
a similar problem and they solved this by creating a PreLoginAgent: http://developer.apple.com/technotes/tn2005/tn2083.html#SECPRELOGINANDTRUST
The problem is, that the script is not logged in into the window
server and the server variant
does not allow calls to itself from not-logged-in apps.
But I'm not sure whether this is the right solution for me..?
Perhaps this is even the right way,
how can I make it work for the python script?
Does anyone have further suggestions or hints to solve this?
Thank you very much in advance!
Hannes
OK,
I did find my project which runs as tool from command line and uses
Appkit methods. The trick is that you need to call [NSApplication
sharedApplication] in your main method.
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
[NSApplication sharedApplication];
// your code here
[pool release];
return 0;
}
HTH
Robert
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macos-x-server mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/macos-x-server/email@hidden