- Install
ptvsd
using the same Python interpreter Qgis uses. E.g. on Windows:
C:\OSGeo4W64\apps\Python37\python.exe -m pip install ptvsd==4.3.2
- Add a debug configuration to
launch.json
:
{
"name": "Python: Remote Attach",
#!/usr/bin/env python3 | |
""" | |
A simple CLI tool to control and monitor the ZKETECH EBC-A20 battery | |
tester from https://www.zketech.com/en/ | |
It can trigger charge or discharge as well as perform charge-discharge | |
cycles to measure battery capacity. | |
Currenly only the CC (Constant Current) load type is implemented, the | |
CP (Constant Power) load type is a simple fixme. Additionally, some |
ptvsd
using the same Python interpreter Qgis uses.
E.g. on Windows:C:\OSGeo4W64\apps\Python37\python.exe -m pip install ptvsd==4.3.2
launch.json
:{
"name": "Python: Remote Attach",
In QGIS install the plugin debugvs
.
The debugvs
plugin needs the python module ptvsd
to function. This module is not installed by default.
In principle you just pip install ptvsd
in the python interpreter used by QGIS.
import asyncio | |
import threading | |
import random | |
def thr(i): | |
# we need to create a new loop for the thread, and set it as the 'default' | |
# loop that will be returned by calls to asyncio.get_event_loop() from this | |
# thread. | |
loop = asyncio.new_event_loop() |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
# GNU General Public License for more details. | |
# |