How to Debug Embedded Python?
Folks!
Could you please share any best practices on how to debug Embedded Python code?
Given I have the following class method:
ClassMethod HideShip() As %Status [ Language = python ]
{
import iris
shipsgl=iris.gref(iris.cls(__name__)._GetParameter("BoardStorage"))
shipsgl.kill()
from random import Random
board=iris.cls(__name__)._GetParameter("BoardRange")
x=random.randint(0,board+1)
y=random.randint(0,board+1)
shipsgl.set([x,y],1)
}
And when I run it shows the following error:
USER>d ##class(eshvarov.sample.SeaBattle.GamePython).HideShip() D ##CLASS(eshvarov.sample.SeaBattle.GamePython).HideShip() ^ <THROW> *%Exception.PythonException <THROW> 230 ^^0^D ##CLASS(eshvarov.sample.SeaBattle.GamePython).HideShip() <class 'KeyError'>: Invalid args -
Any idea how to guess in what line could be the problem?
The one-by-line debugger in VSCode doesn't help (I guess it's not implemented yet).
Product version: IRIS 2022.1
$ZV: IRIS for UNIX (Ubuntu Server LTS for x86-64 Containers) 2022.2 (Build 311U) Wed Aug 10 2022 00:49:03 EDT