You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/debug.md
+74-5Lines changed: 74 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,15 +16,84 @@ IoP is based on [Embedded Python in IRIS](https://docs.intersystems.com/iris2024
16
16
17
17
Embedded Python is a feature of IRIS that allows you to run Python code inside IRIS.
18
18
19
-
That means the python code is not running by a python interpreter, but by the IRIS process.
19
+
That means the python code is not running by a python interpreter, but by an IRIS process.
20
20
21
-
That comes with some limitations, like the lack of a debugger. It's planned to have a debugger in the future. eg: IRIS 2025.2+.
21
+
## Remote Debugging
22
22
23
-
Meanwhile, we **have** some ways to debug the code.
23
+
To remote debbug your code, you need IoP version 3.4.1 or later.
24
24
25
-
## Debugging
25
+
You will then have access to new options in the management portal.
26
26
27
-
Today (2025.2-), the best way to debug the code is to use an native python interpreter and run the code outside IRIS. This way you can use the python debugger.
27
+

28
+
29
+
### Debugging Options
30
+
31
+
-**Enable Debugging**: This option will enable the remote debugging.
32
+
-**Debugging Port**: This option will set the port for the remote debugging. The default port is 0. If you set it to 0, the system will choose a random port. You can also set it to a specific port.
33
+
-**Debugging Interpreter**: In the background, the system will create a new python interpreter. This option will set the interpreter to use. **In most cases, you don't need to change this option.**
34
+
35
+
Then when you start the process, you will see the following message in the logs:
36
+
37
+

38
+
39
+
This means that the system is waiting for a connection on the port you set.
40
+
41
+
Then you can connect to the port with your IDE.
42
+
43
+
If you wait too long, the system will close the port and you will need to restart the process.
44
+

45
+
46
+
If VsCode is connected to the port, you will see the following message in the logs:
47
+

48
+
This means that the system is connected to the port and you can start debugging.
49
+
50
+
### Debugging with VSCode
51
+
52
+
To debug the code with VSCode, you need to have the following:
Then you need to create a new launch configuration for remote debugging.
57
+
58
+
You can follow the steps in the [VSCode documentation](https://code.visualstudio.com/docs/python/debugging#_initialize-configurations) to initialize the configurations.
59
+
You can also use the following configuration:
60
+
61
+
```json
62
+
{
63
+
"version": "0.2.0",
64
+
"configurations": [
65
+
{
66
+
"name": "Python: Remote Debug",
67
+
"type": "python",
68
+
"request": "attach",
69
+
"connect": {
70
+
"host": "<IRIS_HOST>",
71
+
"port": <IRIS_DEBUG_PORT>
72
+
},
73
+
"pathMappings": [
74
+
{
75
+
"localRoot": "${workspaceFolder}",
76
+
"remoteRoot": "/irisdev/app"// for example path inside the container
77
+
}
78
+
],
79
+
}
80
+
]
81
+
}
82
+
```
83
+
You need to change the `<IRIS_HOST>` and `<IRIS_DEBUG_PORT>` to the host and port of your IRIS instance.
84
+
You also need to change the `pathMappings` to the path of your python file in IRIS and the path of your python file in your local machine.
85
+
The path in IRIS is the path of the file in the IRIS instance. The path in your local machine is the path of the file in your local machine.
0 commit comments