← Back to team overview

sikuli-driver team mailing list archive

[Question #268022]: How to enable full error traceback

 

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

Hi RaiMan.
Here is my code: http://joxi.ru/XYmEg7MiBvzyA6
______________________________________________
# coding=utf-8
import sys
from os.path import dirname
from os import putenv
from sikuli.Sikuli import getBundlePath

TEST_DIR = dirname(dirname(dirname(getBundlePath())))
ROOT_DIR = dirname(TEST_DIR)

putenv('TEST_DIR', TEST_DIR)
putenv('ROOT_DIR', ROOT_DIR)

sys.path.append(TEST_DIR)
sys.path.append(ROOT_DIR)

from Core import API, Common, Config
from TestCases.DW import DW
from TestCases.Objects import Building, Dragon, Interface
from sikuli.Sikuli import sleep

######## Local info ########

dw = DW("Breeding Cave test")
dw.bookmark = '#bookmark=kix.e5b4mg9n2ok2'
dw.set_user(Config.USERS_FB[3])
dw.admin.load(dw.user, 'Breeding')
dw.start()
____________________________________________

I specially made an error in class DW in method start(). After starting script I get trace:
[error] script [ D:\autotest\dragon_world\TestCases\Building\BreedingCave.sikuli ] stopped with error in line 27
[error] ZeroDivisionError ( integer division or modulo by zero )
Exception in thread "MainThread" java.lang.IllegalStateException: No match found
	at java.util.regex.Matcher.group(Matcher.java:536)
	at org.sikuli.scriptrunner.JythonScriptRunner.findErrorSourceWalkTrace(JythonScriptRunner.java:356)
	at org.sikuli.scriptrunner.JythonScriptRunner.findErrorSource(JythonScriptRunner.java:321)
	at org.sikuli.scriptrunner.JythonScriptRunner.runPython(JythonScriptRunner.java:226)
	at org.sikuli.scriptrunner.JythonScriptRunner.runScript(JythonScriptRunner.java:183)
	at org.sikuli.scriptrunner.ScriptingSupport$RunBox.run(ScriptingSupport.java:597)
	at org.sikuli.scriptrunner.ScriptingSupport$RunBox.access$400(ScriptingSupport.java:513)
	at org.sikuli.scriptrunner.ScriptingSupport.runscript(ScriptingSupport.java:442)
	at org.sikuli.ide.SikuliIDE.run(SikuliIDE.java:206)
	at org.sikuli.ide.Sikulix.main(Sikulix.java:21)

This trace shows that error caused in line 27 of my script. But this error is not in this line, it's in imported module. But trace do not show this and this is not comfortable.
In earlier versions of SIkuli trace was full and showed complete path to the error.
Also I have code:
def log_uncaught_exceptions(type, value, tb):
    error("\n" + "\n".join(traceback.format_tb(tb)) + str(value))

sys.excepthook = log_uncaught_exceptions

which was getting trace and log it in my filelog.txt. Now it does not work, because you changed something in trace output. Can I turn it off somehow and get complete trace to the error, because this is very uncomfortable for debugging? (Remain classic jython trace)

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