SublimeREPL icon indicating copy to clipboard operation
SublimeREPL copied to clipboard

Repl Closed with python3?

Open diego898 opened this issue 8 years ago • 7 comments

I just installed this plugin and on first run I get the following:

/Users/diego/anaconda3/lib/python3.5/site-packages/IPython/config.py:13: ShimWarning: The `IPython.config` package has been deprecated. You should import from traitlets.config instead.
  "You should import from traitlets.config instead.", ShimWarning)
/Users/diego/anaconda3/lib/python3.5/site-packages/IPython/terminal/console.py:13: ShimWarning: The `IPython.terminal.console` package has been deprecated. You should import from jupyter_console instead.
  "You should import from jupyter_console instead.", ShimWarning)
Traceback (most recent call last):
  File "/Users/diego/Library/Application Support/Sublime Text 3/Packages/SublimeREPL/config/Python/ipy_repl.py", line 52, in <module>
    embedded_shell.initialize()
  File "<decorator-gen-113>", line 2, in initialize
  File "/Users/diego/anaconda3/lib/python3.5/site-packages/traitlets/config/application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/Users/diego/anaconda3/lib/python3.5/site-packages/jupyter_console/app.py", line 137, in initialize
    self.init_shell()
  File "/Users/diego/anaconda3/lib/python3.5/site-packages/jupyter_console/app.py", line 110, in init_shell
    client=self.kernel_client,
  File "/Users/diego/anaconda3/lib/python3.5/site-packages/traitlets/config/configurable.py", line 412, in instance
    inst = cls(*args, **kwargs)
  File "/Users/diego/anaconda3/lib/python3.5/site-packages/jupyter_console/ptshell.py", line 252, in __init__
    self.init_prompt_toolkit_cli()
  File "/Users/diego/anaconda3/lib/python3.5/site-packages/jupyter_console/ptshell.py", line 404, in init_prompt_toolkit_cli
    self.pt_cli = CommandLineInterface(app, eventloop=self._eventloop)
  File "/Users/diego/anaconda3/lib/python3.5/site-packages/prompt_toolkit/interface.py", line 80, in __init__
    self.output = output or create_output()
  File "/Users/diego/anaconda3/lib/python3.5/site-packages/prompt_toolkit/shortcuts.py", line 124, in create_output
    ansi_colors_only=ansi_colors_only, term=term)
  File "/Users/diego/anaconda3/lib/python3.5/site-packages/prompt_toolkit/terminal/vt100_output.py", line 424, in from_pty
    assert stdout.isatty()
AssertionError

***Repl Closed***

diego898 avatar Jan 09 '17 17:01 diego898

I have confronted into the same problems! no updates for a long time.

labro avatar Sep 16 '17 01:09 labro

I found a fix. I'm mac so hopefully you can figure it out for another OS if need be. I went to ~/Library/Application\ Support/Sublime\ Te xt\ 3/Packages/SublimeREPL/config/Python/Main.sublime-menu and changed lines 69-71 so the command just was ["ipython", "-i"].

Of course, this of course assumes that your system or environment has ipython. This plays well with virtualenvs since I am using pyenv.

apapanico avatar Sep 30 '17 00:09 apapanico

There is a gist at this link providing a solution, and an entry explaining it at Stackoverflow.

The solution is relatively old and doesn't work with newer ipython and jupyter versions, it works with the following versions:

pip install -U ipython==4.1.1 jupyter_console==4.1.0

hstojic avatar Jan 12 '18 09:01 hstojic

I had also good luck just by putting a couple of "-i" for "interactive" wherever python3 was called, in the Packages/SublimeREPL/config/Python/Main.sublime-menu

Krabii avatar May 13 '19 23:05 Krabii

@Krabii share the file

SmartManoj avatar Mar 10 '20 12:03 SmartManoj

@Krabii share the file

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

             "children":[
                {"command": "repl_open",
                 "caption": "Python",
                 "id": "repl_python",
                 "mnemonic": "P",
                 "args": {
                    "type": "subprocess",
                    "encoding": "utf8",
                    "cmd": ["python", "-i", "-u"],
                    "cwd": "$file_path",
                    "syntax": "Packages/Python/Python.tmLanguage",
                    "external_id": "python",
                    "extend_env": {"PYTHONIOENCODING": "utf-8"}
                    }
                },
                {"command": "python_virtualenv_repl",
                 "id": "python_virtualenv_repl",
                 "caption": "Python - virtualenv"},
                {"command": "repl_open",
                 "caption": "Python - PDB current file",
                 "id": "repl_python_pdb",
                 "mnemonic": "D",
                 "args": {
                    "type": "subprocess",
                    "encoding": "utf8",
                    "cmd": ["python", "-i", "-u", "-m", "pdb", "$file_basename"],
                    "cwd": "$file_path",
                    "syntax": "Packages/Python/Python.tmLanguage",
                    "external_id": "python",
                    "extend_env": {"PYTHONIOENCODING": "utf-8"}
                    }
                },
                {"command": "repl_open",
                 "caption": "Python - RUN current file",
                 "id": "repl_python_run",
                 "mnemonic": "R",
                 "args": {
                    "type": "subprocess",
                    "encoding": "utf8",
                    "cmd": ["python3", "-u", "-i", "$file_basename"],
                    "cwd": "$file_path",
                    "syntax": "Packages/Python/Python.tmLanguage",
                    "external_id": "python",
                    "extend_env": {"PYTHONIOENCODING": "utf-8"}
                    }
                },
                {"command": "repl_open",
                 "caption": "Python - IPython",
                 "id": "repl_python_ipython",
                 "mnemonic": "I",
                 "args": {
                    "type": "subprocess",
                    "encoding": "utf8",
                    "autocomplete_server": true,
                    "cmd": {
                        "osx": ["python", "-u", "${packages}/SublimeREPL/config/Python/ipy_repl.py"],
                        "linux": ["python3", "-u", "-i", "${packages}/SublimeREPL/config/Python/ipy_repl.py"],
                        "windows": ["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"
                    }
                }
                }
            ]}
        ]
    }]
}

]

Krabii avatar Mar 10 '20 20:03 Krabii

NOTE:

It seem github markdown does not like Sublime configuration files. Be sure to copy the part that is not formatted as code block before and after

Krabii avatar Mar 10 '20 20:03 Krabii