2

I recently installed sublime text 3 in my pc (Ubuntu 13.10). And i also installed Canopy Enthought and set canopy as default python. But Sublime text instead of using the new default python and ipython, its using the "old" version. In windows i used to run ipython console with SublimeREPL and i have no problems with Canopy. I verified in Terminal the following with this results:

    ~$ which python
    /home/ccp/Enthought/Canopy_64bit/User/bin/python
    ~$ which ipython
    /home/ccp/Enthought/Canopy_64bit/User/bin/ipython

So there's no problem with Canopy as default, in Terminal i can access to Canopy python 2.7.3 and also ipython with python 2.7.3 but in sublimeREPL opens python2.7.5+(Ubuntu "old" default). There's some place where i can changed this? i tried reinstalling Sublime Text 3 but it didnt solve the problem.

TERMINAL:

    Enthought Canopy Python 2.7.3 | 64-bit | (default, Dec  2 2013, 16:23:35) 
    [GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> 

PYTHON (SUBLIMEREPL):

    Python 2.7.5+ (default, Sep 19 2013, 13:48:49) 
    [GCC 4.8.1] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> 

2 Answers 2

2

Create a new file with the following contents:

[
     {
        "id": "tools",
        "children":
        [{
            "caption": "SublimeREPL",
            "mnemonic": "r",
            "id": "SublimeREPL",
            "children":
            [
                {"caption": "Python",
                "id": "Python",

                 "children":[
                    {"command": "repl_open",
                     "caption": "Python - Canopy",
                     "id": "repl_python",
                     "mnemonic": "p",
                     "args": {
                        "type": "subprocess",
                        "encoding": "utf8",
                        "cmd": ["/home/ccp/Enthought/Canopy_64bit/User/bin/python", "-i", "-u"],
                        "cwd": "$file_path",
                        "syntax": "Packages/Python/Python.tmLanguage",
                        "external_id": "python",
                        "extend_env": {"PYTHONIOENCODING": "utf-8"}
                        }
                    },
                    {"command": "repl_open",
                     "caption": "Python - IPython - Canopy",
                     "id": "repl_python_ipython",
                     "mnemonic": "p",
                     "args": {
                        "type": "subprocess",
                        "encoding": "utf8",
                        "autocomplete_server": true,
                        "cmd": ["/home/ccp/Enthought/Canopy_64bit/User/bin/python", "-u", "${packages}/SublimeREPL/config/Python/ipy_repl.py"],
                        "cwd": "$file_path",
                        "syntax": "Packages/Python/Python.tmLanguage",
                        "external_id": "python",
                        "extend_env": {
                            "PYTHONIOENCODING": "utf-8",
                            "SUBLIMEREPL_EDITOR": "$editor"
                        }
                    }
                    }
                ]}
            ]
        }]
    }
]

and save it as ~/.config/sublime-text-3/Packages/User/SublimeREPL/config/Python/Main.sublime-menu. This will add Python - Canopy and Python - IPython - Canopy options to the Tools -> SublimeREPL -> Python menu.

Sign up to request clarification or add additional context in comments.

Comments

1

Thanks that actually solved the problem! now im also capable of opening ipython-Canopy with ctrl+shift+i. If anyone whants this configuration my Key Bindings- User its below:

[{ "keys": ["ctrl+shift+i"],                    
                     "command": "repl_open",
                     "caption": "Python - IPython - Canopy",
                     "id": "repl_python_ipython",
                     "mnemonic": "p",
                     "args": {
                        "type": "subprocess",
                        "encoding": "utf8",
                        "autocomplete_server": true,
                        "cmd": ["/home/ccp/Enthought/Canopy_64bit/User/bin/python", "-u",         "${packages}/SublimeREPL/config/Python/ipy_repl.py"],
                        "cwd": "$file_path",
                        "syntax": "Packages/Python/Python.tmLanguage",
                        "external_id": "python",
                        "extend_env": {
                            "PYTHONIOENCODING": "utf-8",
                            "SUBLIMEREPL_EDITOR": "$editor"
                        }
                    }},
{ "keys": ["ctrl+7"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+7"], "command": "toggle_comment", "args": { "block": true } },
]

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.