← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #196092]: How to call type(string, bases, dict) instead of type( [PSMRL], text, [modifiers] )

 

Question #196092 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/196092

    Status: Needs information => Open

Mark gave more information on the question:
I'm talking about Jython (I'm using Sikuli t script in Jython) and it
appears that the static, three parameter, type() function (from Python)
has been overridden to work with matches and "type" keyboard characters.

The function I want to call is documented here:
http://www.jython.org/docs/library/functions.html

However, when I try to call it, Jython emits the following:

    return type('Enum', tuple([object]), enumDict)
TypeError: type(): 2nd arg can't be coerced to String

This tells me that it is trying to dispatch to the type() function
documented here: http://sikuli.org/wiki/reference-0.10#type

here's my code:

def enum(*sequential, **named):
    enumDict = dict(zip(sequential, range(len(sequential))), **named)
    return type('Enum', tuple([object]), enumDict)

states = enum('ONE', 'TWO', 'THREE')


I'm new to Jython, so apologies in advance if some of this makes no sense. To summarize, how can I call the Jython type function of my choice?

TIA RaiMan

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.