← Back to team overview

sikuli-driver team mailing list archive

[Question #264180]: how to import a file in other file between middle of the code

 

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

Hello, 
I want import one file in main file, but when i try to do that i got an error like,

[error] Error message: Traceback (most recent call last):
 File "C:\DOCUME~1\kartheek.m\LOCALS~1\Temp\sikuli-tmp3883511940798183465.py", line 17, in 
 import MSTSC_SIM
 File "C:\Program Files\Sikuli X\sikuli-script.jar\Lib\sikuli\SikuliImporter.py", line 45, in load_module
 File "C:\Program Files\Sikuli X\sikuli-script.jar\Lib\sikuli\SikuliImporter.py", line 29, in _load_module
ImportError: Errors in loading sikuli module: MSTSC_SIM
'with' will become a reserved keyword in Python 2.6 (MSTSC_SIM.py, line 62)
 - HOW TO FIX? Try adding "from sikuli import *" in the module.

my code is:
#### MSTSC_SIM.sikuli
from sikuli import *
import shutil
import os
def startMstsc(event):
    type('r',KeyModifier.WIN)
    wait(1)
    paste("mstsc")
    type(Key.ENTER)
    doubleClick(Pattern("RemoteDeskto.png").targetOffset(-79,0))
    type(Key.DELETE)
    type("simulatorpc1")
    click(Pattern("Qptions.png").targetOffset(-26,9))
    click(Pattern("GeneralDispl.png").targetOffset(-22,3))
    click(Pattern("UISDIGQCClll.png").targetOffset(144,16))
    type(Key.ENTER)
    alertImg = "Dol.png"
    if exists(alertImg):
        type(Key.LEFT)
        type(Key.ENTER)
        wait(5)
    else:
        wait(7)
    doubleClick(Pattern("UsernamePass.png").targetOffset(49,-5))

#main operation
#startMstsc(1)

#######Main.sikuli
import csv

if ((scnName == "general") & (stpTest == "STP-GPSBL-002")): #checking the condition
    print "Done"
    import main
    reload(main)
    from main import *
    startMstsc(1)
    try:
        startApp(1)
        onAppear("7Connected.png", handler)
        observe(FOREVER)
        startTest(1)
        stopMstsc(1)

    except FindFailed:
        popup("image not found")
        print "img not found on the screen"
                    
please solve my doubt, Here i want to call the function inside the if condition.
Thank you in advance :)


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