I'm getting a compile error when i simply try to import a namespace

Asked by Joseph

    import random
    import java.awt.Robot as JRobot
    import java.awt.Color as Color
    from guide import *

do i need to reference these Dlls some place. I have looked online for some information on why my simple import statements wont work but there inst much on importing other than importing other Sikuli scripts

Error Message I'm getting

[info] VDictProxy loaded.

[error] Stopped
[error] An error occurs at line 1
[error] Error message: SyntaxError: ("mismatched input ' ' expecting EOF", ('C:\\Users\\DIARTE~1\\AppData\\Local\\Temp\\sikuli-tmp9157535314717962501.py', 1, 4, ' import random\n'))

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
RaiMan (raimund-hocke) said :
#1

What error?

Revision history for this message
Joseph (joediarte3) said :
#2

[info] VDictProxy loaded.

[error] Stopped
[error] An error occurs at line 1
[error] Error message: SyntaxError: ("mismatched input ' ' expecting EOF", ('C:\\Users\\DIARTE~1\\AppData\\Local\\Temp\\sikuli-tmp9157535314717962501.py', 1, 4, ' import random\n'))

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

Ok, Sikuli talks Python.

You should be familiar with the basics of this language.

In your case the problem is wrong indentation:
leading whitespace is interpreted as indentation which starts a block of code.
In your case this is wrong in this place (see faq 1800)

take care, that the above lines do not have whitespace before the import

Revision history for this message
Joseph (joediarte3) said :
#4

Ok, Ill try it Thank you. I am a .net programmer but I have wanted to start learning python. Its good to know that it uses the same conventions as python. This should make it much easier on me now to fix stuff on my own lol.

Revision history for this message
Joseph (joediarte3) said :
#5

Thanks RaiMan, that solved my question.