Closed fouvy closed 5 years ago
This does not seem to be a pyq issue. Please try to direct your question to the k4 listbox or a vscode forum.
Finally, I use pyvsd to debug my python code in pyq. First, install ptvsd
pip install ptvsd
Then, add debug code, in the python code we wanna debug:
# debug code section
import ptvsd
ptvsd.enable_attach(address=('localhost', 5678), redirect_output=True)
ptvsd.wait_for_attach()
breakpoint()
add python attach to launch.json
{"name":"Python: attach","type":"python","request":"attach","port":5678,"host":"localhost","pathMappings":[{"localRoot":"${workspaceFolder}/kdb","remoteRoot":"."}]}
At last, run code and use vscode attach
pyq your_pyq_python_code.py
Today, I found a new way to debug pyq without ptvsd in vscode. I have python2.7 python3.6 in my ubuntu, and installed pyq under python3.6 env without conda. First, update alternatives and bind pyq to python command
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 2
sudo update-alternatives --install /usr/bin/python python /usr/local/bin/pyq 3
Second, config python command to pyq
sudo update-alternatives --config python
And select: 3 Finally, python command has alternative to pyq. And you can debug pyq code like common python code. Following is my bash command example run pyq:
fouvy@Zoom:~$ python Python 3.6.8 (default, Jan 14 2019, 11:02:34) [GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import pyq >>> exit()
@sashkab @abalkin
If you were to use PyQ inside virtual environment, as we recommend, you could have just symlink python
to pyq
and be done with it. But since you not following our suggestions -- feel free to re-invent the wheel ;-) I'm enjoying reading.
Questions
[ ] Which operating system are you using (if Linux, please provide flavour of it, i.e RedHat, CentOS or Ubuntu), is it 32-bit, or 64-bit?
[ ] Which version of PyQ are you running? Please provide output of
pyq --versions
, if PyQ isn't operational, please provide Python interpreter version and PyQ versionpython -V; python3 -V; pip list | grep pyq
:[ ] Which version of kdb+ are you using, is it 32-bit or 64-bit?
[ ] If on 64-bit, is your
QLIC
set? Please provide outputenv | grep QLIC
on linux/macOS, orset|grep QLIC
on Windows.[ ] Did you use virtual environment to install PyQ? If not, why?
[ ] Where is your
QHOME
? Please provide outputenv | grep QHOME
on linux/macOS, orset|grep QHOME
on Windows.[ ] Do you use Conda? If so, what version?
Steps to reproduce the issue
I want to debug my python code in pyq which runs some query of table in kdb+. Anyone had solved this issue? This is my launch.json when i debug python code without q code under python 3.6 interpreter.
Anyone figured out how to setting pyq interpreter of launch.json in vscode?
Expected result
Actual result
Workaround
If you know workaround, please provide it here.