Hello,
1) I tried your suggestion
@classmethod
def setdefaulttimeout_(cls,timeout):
NSLog("Timeout")
and called
Class pySocket = NSClassFromString(@"pySocket");
[pySocket setdefaulttimeout:10];
And now I get a " Program received signal: “EXC_BAD_ACCESS”. and gdb
starts (Any information required?)
2)Also if I'm calling PyObjc NSObject subclasses from Objective C - i
dont need to add underscores, i think the underscores are
only required if called Objective C methods (to get around the ":"),
e.g I could add the following instance method
def moo(self):
NSLog("Moo")
Instantiate pySocket in objective-c and call [v moo] (v is a pySocket
instance) and this works.
However, I cant seem to call the class method.
Pyobjc v 2
Regards
Saptarshi
On Oct 18, 2008, at 9:09 PM, s s wrote:
Try using:
def setdefaulttimeout_(cls,timeout):
Since your method would be setdefaulttimeout: in objc, it's
necessary to replace the ':' with an underscore in your Python code.
S
aka Steve Steiner
On Oct 18, 2008, at 6:15 PM, Saptarshi Guha wrote:
Hello,
I have a mainly cocoa app which uses some Python modules. I need
to call a classmethod of a NSObject subclass written in
python from Cocoa
=Structure=
After loading the Python interpreter, i call this method
-(void)initialize
{
Class pySocket = NSClassFromString(@"pySocket");
NSLog(@"%@",pySocket);
[pySocket setdefaulttimeout:10];
}
pySocket:
from Foundation import *
import socket
class pySocket(NSObject):
#no init method right now, only want to run class methods
@classmethod
def setdefaulttimeout(cls,timeout):
socket.setdefaulttimeout(timeout)
==Error==
I get the following error:
2008-10-18 17:48:14.227 argnostic[10697:10b] pySocket
2008-10-18 17:48:14.228 argnostic[10697:10b] *** +[pySocket
setdefaulttimeout:]: unrecognized selector sent to class 0x3b33d0
2008-10-18 17:48:14.228 argnostic[10697:10b] *** +[pySocket
setdefaulttimeout:]: unrecognized selector sent to class 0x3b33d0
How then do I call a Python NSObject subclasses classmethods from
cocoa?
Thank you
Saptarshi
Saptarshi Guha | [EMAIL PROTECTED] | http://www.stat.purdue.edu/~sguha
_______________________________________________
Pythonmac-SIG maillist - Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
On Oct 18, 2008, at 6:15 PM, Saptarshi Guha wrote:
Hello,
I have a mainly cocoa app which uses some Python modules. I need
to call a classmethod of a NSObject subclass written in
python from Cocoa
=Structure=
After loading the Python interpreter, i call this method
-(void)initialize
{
Class pySocket = NSClassFromString(@"pySocket");
NSLog(@"%@",pySocket);
[pySocket setdefaulttimeout:10];
}
pySocket:
from Foundation import *
import socket
class pySocket(NSObject):
#no init method right now, only want to run class methods
@classmethod
def setdefaulttimeout(cls,timeout):
socket.setdefaulttimeout(timeout)
==Error==
I get the following error:
2008-10-18 17:48:14.227 argnostic[10697:10b] pySocket
2008-10-18 17:48:14.228 argnostic[10697:10b] *** +[pySocket
setdefaulttimeout:]: unrecognized selector sent to class 0x3b33d0
2008-10-18 17:48:14.228 argnostic[10697:10b] *** +[pySocket
setdefaulttimeout:]: unrecognized selector sent to class 0x3b33d0
How then do I call a Python NSObject subclasses classmethods from
cocoa?
Thank you
Saptarshi
Saptarshi Guha | [EMAIL PROTECTED] | http://www.stat.purdue.edu/~sguha
_______________________________________________
Pythonmac-SIG maillist - Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
Saptarshi Guha | [EMAIL PROTECTED] | http://www.stat.purdue.edu/~sguha
Meade's Maxim:
Always remember that you are absolutely unique,
just like everyone else.
_______________________________________________
Pythonmac-SIG maillist - Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig