I am trying to debug (and get an understanding of what is happening) a Python script that runs on a Raspberry Pi and uses Pygatt to communicate with a BLE peripheral device. I am trying to make it work using Visual Studio Code (because I use it for JavaScript) on a Linux Mint PC. My Python experience is minimal.
The script works fine on the Linux Mint PC with a CSR 4.0 dongle. I open a terminal and enter:
$ /usr/local/bin/python3.6 -i /home/rob/python-test/BLETestTool.py
The script runs, sets up the BLE adapter, and I get the >>> prompt. From there I can issue commands to connect and communicate with the device. The key to this is the "-i" argument. If I leave it out, the script just sets up the BLE adapter, which flashes a bit, and then terminates.
When I try to debug using VS Code the script starts without the "-i" argument and terminates. I have tried numerous settings in launch.json and I have been searching for hours.
Is it possible to invoke the -i argument when debugging Python in VS Code, or any other IDE? Alternatively, is there an alternative way to get the interactive command line experience working?
Any clues would be greatly appreciated.
Thanks in advance,
Rob