Runner for Python3 Virtualenv

runner
python

#1

I’m trying to migrate my code from Pycharm to Cloud9. All my work is in Python 3.

In making the move I first found that I can’t install any packages (pip3 isn’t available); I got around this by following advice to set up a virtualenv. The virtualenv works - pip3 is there and I can install packages successfully.

In order to run my code I need a runner than can use the virtualenv I create and allow me to invoke debugging.

I tried creating my own simple runner to just run the code (no debug initially), but can’t even get the runner to load (I get a ‘No such file or directory’ error).

Does anyone have a working runner they could share that invokes a venv, preferably one with the option to debug?

Incidentally, as an experiment I tried creating a bash script to run the file and it works as expected:

source ~/.virtualenvs/tmp/bin/activate
python3 tst/tst.py

#2

you can use https://github.com/c9/core/blob/master/plugins/c9.ide.run/runners/Python%202.run as an example

{
    "script": [
        "source ~/.virtualenvs/tmp/bin/activate",
        "if [ \"$debug\" == true ]; then ",
        "    python3 -m ikp3db --ikpdb-port=15471 --ikpdb-working-directory=$project_path $file $args",
        "else",
        "   python3 $file $args",
        "fi",
    ],
    "debugport": 15471,
    "$debugDefaultState": false,
    "debugger": "pythondebug",
    "selector": "^.*\\.(python|py)$",
    "python_version": "python3",
    "info": "...",
    "env": {
        "PYTHONPATH": "$python_path"
    }
}

it should work after installing ikp3db module.