Python3 debugging


#1

I’d wish there would be a Python debugger! Maybe based on pdb.


#2

It could rely on pydev, as Eclipse does. It manages to provide a full debugger that way, with on screen breakpoints, stack trace, inspection, etc.


#3

We have a Xdebug protocol client which could be adapted to work with the Komodo Python Debugging Client. Does anybody have experience with this library? I would be interested to hear if it works well.


#4

Which library are you using for JavaScript debugging?


#5

We connect to the V8 debugger engine, you can read the source code at https://github.com/c9/c9.ide.run.debug/tree/master/debuggers/v8


#6

@xoob: Did you investigate further with Komodo python debugger?


#7

Is anyone working on this? I didn’t realize it wasn’t supported. Wish I had written the script in node :frowning:
Thanks
Andy


#8

For reference to anybody looking for this. If you have a local IDE that supports pydev, like Eclipse or PyCharm, you can use pydev on cloud9. Just install pydev, and set a trace in you cloud9 code.

You can also set a SSH remote workspace, so you can SSH into your machine running cloud9 and do a remote debugging if your IDE supports remote interpreters.

We are still waiting for a better solution from cloud9 to debug python.


#9

Recently we have added python 2 debugger support using https://github.com/audaxis/c9.ide.run.debug.ikpdb, please try it and let us know what do you think.


#10

Hi @harutyun,

I have tested the python debugger support using ikpdb. It works well.

I found that the next step button does behave as a step into sometimes and when a single line of code has multiple calls to other methods, you have to step for each one, make the debugging somewhat confusing. The expected behavior in this case is that the next step goes from one line to the other (with the exception maybe of nested fors).

I also found that when a variable contains a complex object, hovering over a variable.object appearance in the code shows an error because it cannot find “object” inside the variable, which is wrong.

Besides this 2 set backs I think it works pretty well. And I can work around this also. For everyday debugging it is a tool I can work with. Very good news.

Thanks


#11

Can’t use it because we only have Python 3 projects. Python 2.7 is now about six or seven years old and all the cool features are only available in Python 3. :frowning:


#12

+1 here for python3 remote debug support. Is this on the roadmap?


#13

Changed the title to Python3 because debugging for Python2 is now supported.

I’d imagine you can make a pull request to that repository for the Python2 debugger and make some changes so it supports Python3.


#14

Is anyone still looking into this? It really would be good to have a debugger for python3


#15

Definitely interested in a python3 debugger


#16

The author of ikpdb have created a version for python3.6 https://pypi.python.org/pypi/ikp3db/1.0.
This is still not included in cloud9 by default, because of the old version of python still used in cloud9 workspaces, but you can install 3.6 using for instance pyenv, then copy python2 runner and change python2 to python3.6 and -m ikpdb to -m ikp3db


#17

Below are all of the steps to install conda (which has) py3.6 and then ikp3db and a new runner to call it.

Get conda:
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
Install it:
sudo bash Miniconda3-latest-Linux-x86_64.sh
cd to the miniconda directory and use the conda pip to install ikp3db:
cd /home/ubuntu/miniconda3
sudo -H ./bin/pip install ikp3db
Create a runner:
select menu cmd Run / Run with / New Runner
fill in the template with:
// Create a custom Cloud9 runner - similar to the Sublime build system
// For more information see https://docs.c9.io/custom_runners.html
{
“script”: [
“if [ “$debug” == true ]; then “,
” /home/ubuntu/miniconda3/bin/python -m ikp3db --ikpdb-port=15471 --ikpdb-working-directory=$project_path $file $args”,
“else”,
" /home/ubuntu/miniconda3/bin/python $file $args",
“fi”,
“checkExitCode() {”,
" if [ $1 ] && [ “$debug” == true ]; then “,
” python -m ikpdb 2>&1 | grep -q ‘No module’ && echo '",
" To use python debugger install ikpdb by running: “,
” sudo apt-get update;",
" sudo apt-get install python-dev;",
" sudo pip install ikpdb;",
" '",
" fi",
" return 1", "}", "checkExitCode ?"
],
“debugport”: 15471,
"debugDefaultState": false, "debugger": "pythondebug", "selector": "^.*\\.(python|py)",
“python_version”: “python3”,
“info”: “Running conda py3.6\n”,
“env”: {
“PYTHONPATH”: “$python_path”
}
}

Save this as something like ‘Py36_ikp3db’

After running program the first time click the bug shaped debug icon at the top of the output window,
then rerun the program.
It will stop at breakpoints. You can see var values in the right pane or by hovering over the var name.
Works great!
Thanks for the info in the previous post by harutyun.

NOTE: all of the leading spaces in the runner script were removed the forum editor.
See https://github.com/c9/core/blob/master/plugins/c9.ide.run/runners/Python%202.run#L4
for how the indenting should look.