← Back to team overview

sikuli-driver team mailing list archive

[Question #243053]: Using external python module using json

 

New question #243053 on Sikuli:
https://answers.launchpad.net/sikuli/+question/243053

Hello,

I want to use an external python module that uses json internally.
I took a look at this post "https://answers.launchpad.net/sikuli/+question/193318"; which is not far from my problem.

I understand that json isn't part of Jython, and that I can workaround this using simplejson.

I downloaded and integrated simplejson in the Lib folder, inside my Sikuli installation.
I realised after that simplejson seems to be already part of Sikuli 1.0.1 and that Jython version :) 

So, back to my json problem... when I import my external module and uses the function from this module, I always get :
[error] NameError ( global name 'json' is not defined )

I tried things like : import simplejson as json
But I can't find a way to make my script work. I always come back to this error :(

Here's an example of a non-working code, written directly in my Sikuli script:
    client = APIClient('some_server') 
    client.user = 'some_user'
    client.password = 'some_password'

    result = client.send_post('some_json')  <== [error] NameError ( global name 'json' is not defined )

The module is using a APIClient class internally... is this conflicting with an APIClient class already existing in Jython? Is is the same class?

I'm afraid I might have to adapt this external module... (I'll do it if I have no choice)
I'm a bit loss trying to get this external module to work in Sikuli :(

Thanks for the help.
Michael



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