How do we start the python3 code through sublimeREPL?



  • Fail Packages/sublimeREPL/config/Python/Main.sublime-menu

    [
     {
        "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": ["/usr//bin/python3", "-i", "-u"],
                    "cwd": "$file_path",
                    "syntax": "Packages/Python/Python.tmLanguage",
                    "external_id": "python",
                    "extend_env": {"PYTHONIOENCODING": "utf-8"}
                    }
                }
            ]
            }
        ]
        }]
    }
    

    ]

    Fail Packages/sublimeREPL/config/main.sublime-menu

    [
    {
    "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": ["/usr/bin/python3", "-i", "-u"],
                    "cwd": "$file_path",
                    "syntax": "Packages/Python/Python.tmLanguage",
                    "external_id": "python",
                    "extend_env": {"PYTHONIOENCODING": "utf-8"}
                    }
                }
            ]
            }
        ]
        }]
    }
    

    ]



  • The Python programme from SublimeText with a defined package SublimeREPL is implemented from the menu:

    Tools > SublimeREPL > Python > Python - RUN current file
    

    Either if you need a rolling launch, add to the Preferences stat KeyBindings - User:

    [
        { "keys": ["ctrl+shift+r"], "command": "repl_open",
                     "caption": "Python - RUN current file",
                     "id": "repl_python_run",
                     "mnemonic": "d",
                     "args": {
                     "type": "subprocess",
                     "encoding": "utf8",
                     "cmd": ["python", "-u", "$file_basename"],
                     "cwd": "$file_path",
                     "syntax": "Packages/Python/Python.tmLanguage",
                     "external_id": "python",
                     "extend_env": {"PYTHONIOENCODING": "utf-8"}
       },
    ]
    

    where "ctrl+shift+r" is the required combination of keys.

    At the same time, SublimeText will perform your command as a system interpreter of the python, which is what you're talking about when the python team is on the OS command line. If you have python 3, you'll have the same version on SublimeText.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2