Sikuli on eclipse (Pydev) : Solution for undefined variable

Asked by jéjé03

Hi everybody, I'd like to know if there is a solution for "undefined variable" issue (e.g. click(), hover()...) in eclipse.
I use Sikuli in eclipse with Pydev pluging and I have this problem.
I already khnow that's a reccurent issue but is there a solution now?

Thank's for answers.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
j (j-the-k) said :
#1

do you have
from sikuli.Sikuli import *
as first line of your script?
This is needed if you run a sikuliscript in eclipse to access the sikuli-commands.
If you have this line in your code and it's still not working, please post your code here.

Revision history for this message
jéjé03 (skaper03) said :
#2

Yes I have

Just a part of my code:

# -*- coding: Latin-1 -*-

from sikuli.Sikuli import *
import Utilitaires.Fonctions as Projet

...
some declarations variables
...

    if not exists(Library):
        Projet.OpenViewMenu()
        hover(Pattern(View).targetOffset(97, 13))
        click(Lib)
        sleep(2)
    else :
        click(Pattern(Library).similar(0.6))

    # omnilight
    sleep(2)
    click(Lights)

....

Revision history for this message
Best RaiMan (raimund-hocke) said :
#3

Are you talking about the fact, that in the PyDev editor click() ... is not recognized by the syntax checker?

If yes, this cannot be solved at all, since the registration of these methods to the constant Screen object SCREEN (which is Screen(0)) is done at runtime.

If you want to solve it, you have to qualify the methods yourself:

s = Screen(0)
s.click()

Revision history for this message
jéjé03 (skaper03) said :
#4

Ok I would know that. Thanks for answers.

Revision history for this message
jéjé03 (skaper03) said :
#5

Thanks RaiMan, that solved my question.