Hi
As I posted in another thread, I'm trying to port some code from uopy to u2py but I can't debug the code properly.
I'm using Visual Studio code, connected remotely to a server via ssh.
I have a really simple launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug manual launch",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/test_file.py",
"python": "/u2/uv/python/bin/python3",
"console": "integratedTerminal",
"justMyCode": false,
"args": [],
"cwd": "${workspaceFolder}",
"env": {"PYTHONPATH": "${workspaceFolder}:${env:PYTHONPATH}"}
}
]
}
The test file is something very simple:
def test_u2py():
import u2py
c = u2py.Command('WHO', capture=True)
l = c.run()
print(l)
return l
And I can call it from BASIC:
NOMBRE.SCRIPT='test_file'
NOMBRE.FUNCION='test_u2py'
RESPUESTA=PyCallFunction(NOMBRE.SCRIPT,NOMBRE.FUNCION)
CRT RESPUESTA
But when I try to run it the interpreter just crashes and exits. I guess u2py expects some kind of "session" and is not finding it, so it fails (breaking the python interpreter, also).
Is there a way to debug u2py code from the terminal?
I tried this experiment, but it doesn't work
def test_u2py():
with uopy.connect(host='', user='', password='', account='') as s:
c = u2py.Command('WHO', capture=True)
l = c.run()
print(l)------------------------------
Héctor Cortiguera
Quiter Servicios Informaticos SL
------------------------------