Can anybody tell me about below error which I am getting while starting my test


This is the error I am getting:
SyntaxError: !!WHILE IMPORTING!! mismatched input ‘def’ expecting INDENT (, line 17)

Full error stack is below:

[error] script [ full_RT_test_run ] stopped with error at line --unknown--
[error] Error caused by: Traceback (most recent call last): File "C:\Users\Administrator\Desktop\Sikuli\on till regression test\full_RT_test_run.sikuli\", line 3, in <module> import cancel_receipt File "C:\Users\Administrator\AppData\Roaming\Sikulix\Lib\sikuli\", line 45, in load_module return self._load_module(module_name) File "C:\Users\Administrator\AppData\Roaming\Sikulix\Lib\sikuli\", line 34, in _load_module return imp.load_module(fullname, file, pathname, desc) File "<string>", line None SyntaxError: !!WHILE IMPORTING!! mismatched input 'def' expecting INDENT (, line 17)

This is my cancel_receipt class:

import general_buttons
import general_functions
import globals
import gui_screens
import error_handling

from sikuli import *

global process_name
process_name = 'Cancel Receipt'

global four_eyes_test
four_eyes_test = 0

def cancel_receipt():
def cancel_receipt():
    globals.current_process_name = process_name
    general_functions.extended_wait(['main_page_key_pad'], globals.very_long_wait, 0)
    general_functions.start_of_test_case('CANCEL RECEIPT TEST CASES')

    x = 0
    while x < 3:

        # wait for the main screen to be there
        general_functions.extended_wait(['main_page_key_pad'], globals.very_long_wait, 0)

        # if it's the regression test get the number of articles specified in te test settings
        general_functions.fill_basket(globals.general_articles[0][4], 1)

        if x == 0:  # cancel before the total button is clicked
            general_functions.start_of_test_case('TC cancel receipt before total button is clicked')
            receipt_meta_data_array = general_functions.get_receipt_meta_data()
        else: # cancel after the total button is clicked
            # click TOTAL button
            general_functions.start_of_test_case('TC cancel receipt after total button is clicked')
            receipt_meta_data_array = general_functions.get_receipt_meta_data()
            # this is actually the CANCEL TRANSACTION button but it's in the same location as the CANCEL button

        general_functions.four_eyes_enhanced(globals.users[2], globals.users

And this is the starting of my

import init
import basic_sale
import cancel_receipt
import commission_sale
import drop_off


You have a repeated line:

def cancel_receipt():
def cancel_receipt():

Also note that this isn’t really a class, it’s a module.

Answered By – 2e0byo

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published