I tried this also but its not working
The new build won't let me use a keybinding to run SublimeREPL
It seems some users are trying to use a build system sublime repl, whereas other are having issues with key bindings. So far it appears everyone who is having trouble is using Windows?
+1 have this problem too on Win 10 and virt machine with Win XP. I used to run file with same code as @waleedrajab :
{
“target”: “run_existing_window_command”,
“id”: “repl_python_run”,
“file”: “config/Python/Main.sublime-menu”
}
( this is my .sublime-build file)
tried without key binding - sublime repl is working - I can transfer the file to repl, but I cannot build and run, which is much more useful then transferring file
downloaded older version - all continued working on both OS’s
I recommend also posting this issue and reacting on the SublimeREPL repository. Unfortunately the way SublimeREPL works isn’t typical for a plugin, so there may be something going on under the hood that isn’t working.
MonsterGuo’s solution worked, however there is a missing } (likely typo) Correct version is:
{
"keys": ["f5"],
"command": "repl_open",
"caption": "Python - RUN current file",
"id": "repl_python_run",
"mnemonic": "R",
"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"}
}
}
Appears to be a problem with how SublimeREPL interacts with the new version.
I find the solution for Sublime-ipython,
{
"keys": ["f1"],
// The code below comes from /Packages/SublimeREPL/config/Python/Main.sublime-menu
"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": ["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"
}
}
},
I’ve done this to key bind sublime repl to the ctrl + b , but I need to save the file before it runs the code… I still cannot figured out how… I tried the Command chain plugin, but still does not works (I changed the \ with / and now it autosaves on build!!! ) but I still have a problem … it saves after build, not before
[
{“keys”: [“ctrl+b”], “command”: “repl_open”,
“caption”: “Python - RUN current file”,
“id”: “repl_python_run”,
“mnemonic”: “d”,
“args”: {
“type”: “subprocess”,
“encoding”: “utf8”,
“cmd”: [“C:/Users/giova/AppData/Local/Programs/Python/Python37-32/python.exe”, “-u”, “-i”, “$file_basename”],
“cwd”: “$file_path”,
“syntax”: “Packages/Python/Python.tmLanguage”,
“external_id”: “python”,
“extend_env”: {“PYTHONIOENCODING”: “utf-8”}
}}
]
you can add an “-i” after “-u” to use the interactive mode, so that you can interact with the code even after it has been executed like in a shell
@wbond … plz tell us how to solve this issue …
I know that you know it’s affecting our work , but still do let us know about it …
Sorry for my late reply. My issue was my keybinding which worked in my previous version of Sublime Text. I upgraded to version 3200 and my keybinding stopped working.
My original user-defined key binding was this:
{
“keys”: [“ctrl+alt+b”], “command”: “run_existing_window_command”, “args”: {
“id”: “repl_python_run”,
“file”: “config/Python/Main.sublime-menu”
}
},
I put in the Menu-selection hack suggested by zrobotics and it worked. I left the key as f5 by choice.
{
“keys”: [“f5”],
“command”: “repl_open”,
“caption”: “Python - RUN current file”,
“id”: “repl_python_run”,
“mnemonic”: “R”,
“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”}
}
},
This resolved my issue.
Are you saying that my original method would work for build 3202?
Yes, what you were using originally should work in 3202. The issue was a problem in the run_existing_window_command
command in SublimeREPL that caused it to not work in build 3200.
Thanks, updating to 3202 worked find for me.
3200 works on macOS, I only noticed this problem on my windows machine.
That particular problem in SublimeREPL is specific to Windows directly; internally the command is using OS specific path separators even though it should always be using /
instead; so on Windows, where the path separator is \
, it doesn’t work.
i also meet the same problem.
i use windows system.
i set the key bindings like this:
[
{
“keys”: [“ctrl+b”],
“caption”: “Python - RUN current file”,
“command”:“run_existing_window_command”,
“args”:
{
“id”: “repl_python_run”,
“file”: “config/Python/Main.sublime-menu”
}
},
]
but when i run the python code in sublime text 3 3200 with the [ ctrl + b ] key
i found it does’t work
it does’t raising any error,just seem like do nothing.
the problem occurs after updating the version from 3146 to 3200