0

I am trying to run an iPython file in an interactive shell in Sublime Text 2. This is my first plugin I've written.

Here's what I have so far:

import sublime, sublime_plugin

    class IpydevCommand(sublime_plugin.WindowCommand):
        def run(self):
            self.window.run_command('repl_open',{"type": "subprocess",
                                                 "encoding": "utf8",
                                                 "cmd": ["ipython", "-i", "$file_basename"],
                                                 "cwd": "$file_path",
                                                 "syntax": "Packages/Python/Python.tmLanguage",
                                                 "external_id": "ipython",
                                                 })
            self.window.run_command('move_to_group', { "group": 1 }) 

The issue here is that I don't get an interactive environment after. The view is all messed up. Any ideas how to fix this?

Thanks

Chet
  • 18,421
  • 15
  • 69
  • 113

1 Answers1

0

Instead of running a notebook, you can directly call ipython using following configuration at the keymap bindings:-

[

{ "keys": ["f9"], "command": "repl_open", "caption": "Python - IPython", "id": "repl_python_ipython", "mnemonic": "p", "args": { "type": "subprocess", "encoding": "utf8", "autocomplete_server": true, "cmd": { "osx": ["python", "-u", "${packages}/SublimeREPL/config/Python/ipy_repl.py"], "linux": ["python", "-u", "${packages}/SublimeREPL/config/Python/ipy_repl.py"], "windows": ["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" } } } ]

So, By clicking F9, it will open ipython on new shell