SublimeREPL icon indicating copy to clipboard operation
SublimeREPL copied to clipboard

cannot find REPL for 'python'

Open mherrarte opened this issue 11 years ago • 4 comments

Hi,

When i choose in REPL, EVAL or TRANSFER i have the following error running a py:

Cannot find REPL for 'python' I use python 3, and reading other post i make this changes to use in sublime text 3

1.Create a file name: Python3.sublime.build with the following code:

{ "path": "/Library/Frameworks/Python.framework/Versions/3.3/bin/", "cmd": ["python3.3", "-u", "$file"], "env":{}, "file_regex": "^[ ]File "(...?)", line ([0-9]*)", "selector": "source.python" } Then i have the option to build a Python3 System

2.In settings in sublime REPL - Default i put this:

"default_extend_env": {"PATH": "/Library/Frameworks/Python.framework/Versions/3.3/bin/python3:{PATH}"}, and change the file Main.sublime-menu in located in Packages/SublimeREPL/config/Python with this:

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

             "children":[
                {"command": "repl_open",
                 "caption": "Python 3",
                 "id": "repl_python3",
                 "mnemonic": "p",
                 "args": {
                    "type": "subprocess",
                    "encoding": "utf8",
                    "cmd": ["/Library/Frameworks/Python.framework/Versions/3.3/bin/python3", "-i", "-u"],
                    "cwd": "$file_path",
                    "syntax": "Packages/Python/Python.tmLanguage",
                    "external_id": "python",
                    "extend_env": {"PYTHONIOENCODING": "utf-8"}
                    }
                },
                {"command": "repl_open",
                 "caption": "Python 3 - IPython",
                 "id": "repl_python_ipython3",
                 "mnemonic": "p",
                 "args": {
                    "type": "subprocess",
                    "encoding": "utf8",
                    "autocomplete_server": true,
                    "cmd": {
                        "osx": ["/Library/Frameworks/Python.framework/Versions/3.3/bin/python3", "-u", "${packages}/SublimeREPL/config/Python/ipy_repl.py"],
                        "linux": ["/Library/Frameworks/Python.framework/Versions/3.3/bin/python3", "-u", "${packages}/SublimeREPL/config/Python/ipy_repl.py"],
                        "windows": ["/Library/Frameworks/Python.framework/Versions/3.3/bin/python3", "-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"
                    }
                }
                }
            ]}
        ]
    }]
}

] I think there's must be an easy way to refer python 3 but i don't find it or not find clear. When i choose in Tools, SublimeREPL, Python and Python 3 it open a new tab with python 3

mherrarte avatar Mar 05 '14 17:03 mherrarte

I believed this is relevant:

Sublime Text can't find interpreters for SublimeREPL

Lywx avatar Jun 12 '15 02:06 Lywx

I'm currently only using python 3.5 with ST3 as my editor on a win10 64bit machine.

I made the following changes to make SublimeREPL open Python REPL automatically whenever it is not already open. Thought that others might be interested too or ideally improve it to make it work for any language...

In AppData\Roaming\Sublime Text 3\Packages\SublimeREPL look for the file text_transfer.py. In line 150 replace the sublime.error_message("Cannot find REPL for '{}'".format(external_id)) with the following:

            if external_id == 'python':
                sublime.active_window().run_command(
                    "run_existing_window_command",
                    {
                        "file": "config/Python/Main.sublime-menu",
                        "id": "repl_python"
                    }
                )
                self.run(edit, external_id, text, with_auto_postfix)
            else:
                sublime.error_message(
                    "Cannot find REPL for '{}'".format(external_id)
                )

So whenever there is no Python REPL, first a REPL will be opened by calling the related menu command and then the run function calls itself again, this time having access to a REPL.

5j9 avatar May 20 '16 07:05 5j9

I had the same problem but it says cannot find repl for python.django.

Zarmani avatar Apr 13 '17 04:04 Zarmani

Did the same, updated the text_transfer.py. Now, it takes me to the console of python, than stay put on the same tab (in sublime) which is not expected.

Any better results pls..

babuasian avatar Mar 23 '18 10:03 babuasian