error while Importing

Asked by Sikulipro

I have used this :-
import sys
sys.path.append('/D:\Testing\Sikuli Scripts\Login.sikuli')
import Login

         i am getting an error :- NameError ( !!WHILE IMPORTING!! name 'openApp' is not defined )

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

look docs

Revision history for this message
Sikulipro (saindane-harshal) said :
#2

i get this from doc , but getting an error.

Script1:

......

Script2:

from Script1 import *

reload(Script1)

error:-
NameError ( name 'Login' is not defined )

Revision history for this message
Sikulipro (saindane-harshal) said :
#3

NameError ( !!WHILE IMPORTING!! name 'openApp' is not defined

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

*** this is for the openApp problem
the docs clearly say:
your imported script must contain (recommendation: as first line) the following statement: from sikuli import * (this is necessary for the Python environment to know the Sikuli classes, methods, functions and global names)

*** NameError ( name 'Login' is not defined )
no chance to help, since I do not know the contents of Scxript 1 and Script2

Revision history for this message
Sikulipro (saindane-harshal) said :
#5

Script1: Login

openApp(r"C:\Program Files\Mozilla Firefox\firefox.exe")
type("1392129652457.png", "http://dev.brinv.com/Trunk/Login.aspx")
type(Key.ENTER)
wait("1392129841420.png", 60)
type("1391594569496-1.png", "test")
type(Key.TAB+"test")
click("1391592750343.png")
sleep(20)

now i just want to call the module Login in module Login2

Script2 : Login2

from Login import *

reload(Login )

error: ( !!WHILE IMPORTING!! name 'openApp' is not defined )

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

go back to comment #4 and read carefully from beginning ;-)

Revision history for this message
Sikulipro (saindane-harshal) said :
#7

Thanks RaiMan, that solved my question.