Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@16ucs215

This comment has been minimized.

Copy link

commented Sep 10, 2017

Thank you. I am trying to learn python and this is quite helpful in this.

@ChaoPen

This comment has been minimized.

Copy link

commented Oct 20, 2017

Tx.
Save the test files before Press Ctrl +b

@FortunexFortune

This comment has been minimized.

Copy link

commented Nov 15, 2017

Thank you so much

@raytso

This comment has been minimized.

Copy link

commented Dec 19, 2017

thanks. this saved me hours of searching.

@fitz99

This comment has been minimized.

Copy link

commented Dec 20, 2017

Thanks. This is really helpful. I get crashes when there are spaces in the path name to the python script. Any idea how to deal with that in Sublime Text? If I quote the path when executing from the terminal it works fine, but I don't know how to do that from a build system in Sublime.

@gbengaPS

This comment has been minimized.

Copy link

commented Jan 6, 2018

@zaemiel Thanks for this. It was really helpful for me. I'm learning Python3

@Nirmal-Kr

This comment has been minimized.

Copy link

commented Jan 19, 2018

Thanks, brother... Really it was very helpful.

@alexhigley

This comment has been minimized.

Copy link

commented Jan 23, 2018

What version of python will this give me? Looking for 3.6

@ww7

This comment has been minimized.

Copy link

commented Jan 25, 2018

For Windows version 3.x need to hardlink binary to python3.exe
I have 2.7 and 3.6 installed with same name

@roroboyeitor

This comment has been minimized.

Copy link

commented Feb 7, 2018

Thanks!

@andreeanner

This comment has been minimized.

Copy link

commented Feb 7, 2018

Thank you

@captsisko

This comment has been minimized.

Copy link

commented Feb 13, 2018

Appreciated!
Thank you very much.

@Alex-dlc

This comment has been minimized.

Copy link

commented Feb 27, 2018

Hi, I get this message: [Errno 2] No such file or directory

Any idea how to fix this?

@bityob

This comment has been minimized.

Copy link

commented Feb 28, 2018

Hi @zaemiel,

You should remove the "-i" argument,

it just runs the script in "interpreter" mode, which means, that your process keeps open like an interpreter.

image

But if you remove it, you will see the process just ended completely.

image

@fasilminale

This comment has been minimized.

Copy link

commented Mar 4, 2018

can't open file &file: [error 2] No such file or directory,

@benjaminFaguer

This comment has been minimized.

Copy link

commented Apr 4, 2018

Thank you! This fixed my issue and thank you @bityob, that '>>>' was bothering me as well!

@julienreszka

This comment has been minimized.

Copy link

commented Apr 22, 2018

thank you, I removed the "-i" argument

@hwlv

This comment has been minimized.

Copy link

commented Apr 27, 2018

Thank you ,big brother

@dondasasmita

This comment has been minimized.

Copy link

commented May 2, 2018

Thank you, clear instructions.

@Trece-1101

This comment has been minimized.

Copy link

commented May 23, 2018

Thank you so much!!

@moadAlami

This comment has been minimized.

Copy link

commented May 24, 2018

You sir deserve a cookie!

@jorgeyvr

This comment has been minimized.

Copy link

commented May 24, 2018

Hello!

I haved installed python 3.6 and I tried to link it with Sublime but when I check the version on sublime it keeps displaying:

2.7.10 (default, Oct 6 2017, 22:29:07)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)]
[Finished in 1.0s]

Any thoughts

Cheers!

Thank you!

@soyun4595

This comment has been minimized.

Copy link

commented May 28, 2018

thank you :)

@samael98

This comment has been minimized.

Copy link

commented Jun 16, 2018

this is the error message i keep getting....how do i correct it? anybody?

[WinError 2] The system cannot find the file specified
[cmd: ['python3', 'D:\math.py']]
[dir: D:]
[path: C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Users\Stark.Tony\AppData\Local\Programs\Python\Python36\Scripts;C:\Users\Stark.Tony\AppData\Local\Programs\Python\Python36;C:\Users\Stark.Tony\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Java\jdk-9.0.4\bin;]
[Finished]

@biswa-13

This comment has been minimized.

Copy link

commented Jun 17, 2018

Hi In my case I have installed Python 3.6.2 and for this, I have to change a little bit in the cmd part of the given JSON object. So for me, Python3 did not work instead py did the work.

{
"cmd": ["py", "-i", "-u", "$file"],
"file_regex": "^[ ]File "(...?)", line ([0-9]*)",
"selector": "source.python"
}

@knightowl2704

This comment has been minimized.

Copy link

commented Jun 20, 2018

Thanks

@DavidLapenaGarcia

This comment has been minimized.

Copy link

commented Jul 12, 2018

Hi. I have that:
{
"cmd": ["python3" , "-i","-u" , "$file"],
"file_regex": "^[ ]File "(...?)", line ([0-9]*)",
"selector":"source.python"
}
Of corse i did: Go to Tools -> Build system -> and check python3_7 . (In my case, 3.7)
But Sublime text 3 keep running python 2.7.10.
Any idea why?

@RuslanUchan

This comment has been minimized.

Copy link

commented Jul 19, 2018

To make the build system work, you must specify the PATH to the python interpreter like "cmd" : ["PATH TO INTERPRETER" etc.. ]

To do that, do this in your python shell

import sys
print(sys.executable)

And then it'll print out the PATH to the python interpreter. Copy that PATH to replace the "python3". For Windows user, use double \ (\) to specify your PATH. Example: C:\\PATH\\TO\\INTERPRETER\\python.exe

Hope this helps :)

@tejasa97

This comment has been minimized.

Copy link

commented Aug 1, 2018

I'd really rather not use the '-i' flag as it keeps the code running even after execution; something I think isn't really needed. I've unknowingly been using it with the flag all this time and after an exhausting bout of coding and testing, I open my system monitor to find a plethora of 'python3's lol

@lokpatimishra

This comment has been minimized.

Copy link

commented Aug 5, 2018

@bityob

Thank you very much for your "i" argument suggestion . It save me from lot of trouble....):

@jkunimune15

This comment has been minimized.

Copy link

commented Aug 10, 2018

Your file regex is wrong and will not work. You're missing several asterisks:

{
    "cmd": ["python2", "-u", "$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python"
}
@kartikjai9

This comment has been minimized.

Copy link

commented Sep 4, 2018

I have an error showing
**Access denied
Please help how to get access

@hdsingh

This comment has been minimized.

Copy link

commented Sep 9, 2018

Thanks a lot!!!!!

@wrathinc

This comment has been minimized.

Copy link

commented Sep 17, 2018

Thank you so much!!!

@WillyD57

This comment has been minimized.

Copy link

commented Oct 8, 2018

I have an issue I believe your post will solve, but I do not have it working yet. I am using the Anaconda3 distribution of Python. During the anaconda installation it specifically tells you NOT to put python in your windows path. Because of that Sublime can't find python if you use it to do a build. So, I used your technique to solve the issue. But I added the entire path to my python install like this:

{
"cmd": ["C:\users\billa\anaconda3\python", "-i", "-u", "$file"],
"file_regex": "^[ ]File "(...?)", line ([0-9]*)",
"selector": "source.python"
}

I saved the file as Python3.build.sublime-build and then under build systems menu I selected Python3.build. But when I hit Ctrl + B nothing happens.

The only thing I see, at the bottom left corner of the Sublime window the words "No Build System" flash for just a second or two.

Do you have any idea what the problem is now?

Thanks
Bill

@almozaai

This comment has been minimized.

Copy link

commented Oct 13, 2018

Thanks, it is very helpful.

@maryam-musalam

This comment has been minimized.

Copy link

commented Oct 21, 2018

thank you its really helped

@willaumar

This comment has been minimized.

Copy link

commented Oct 29, 2018

thanks

@juanibar

This comment has been minimized.

Copy link

commented Nov 18, 2018

cool thank really healpfull!

@Akshaykunnavil

This comment has been minimized.

Copy link

commented Nov 19, 2018

This was really helpful. I didn't knew that sublime text by default checks for python 2.
thanks.

@yash3x

This comment has been minimized.

Copy link

commented Nov 21, 2018

Thanks a lot 😊

@perevertysh

This comment has been minimized.

Copy link

commented Feb 6, 2019

GThx!

@qtoq126

This comment has been minimized.

Copy link

commented Feb 18, 2019

very useful, 3q

@pythonlearning1207

This comment has been minimized.

Copy link

commented Feb 19, 2019

thank you so much!

@7549brijesh

This comment has been minimized.

Copy link

commented Mar 4, 2019

it is running the python code but does not react or perform action to input

@cterizi

This comment has been minimized.

Copy link

commented Mar 8, 2019

It works. Thanks!

@suhasakowshik

This comment has been minimized.

Copy link

commented Mar 12, 2019

Thanks a lot!!!

@baotang2118

This comment has been minimized.

Copy link

commented Mar 17, 2019

It works. Thanks a lot 👍

@bsgdragao

This comment has been minimized.

Copy link

commented Mar 27, 2019

perfect.

@Jensenkho

This comment has been minimized.

Copy link

commented Apr 1, 2019

This is my Window 10 Sublime Text 3 setup from Python 3.5 to 3.7 version. It works!
{
"cmd": ["C:\Users\User\AppData\Local\Programs\Python\Python37-32\pythonw.exe", "-u", "$file"],
"file_regex": "^[ ]File "(...?)", line ([0-9]*)",
"selector": "source.python"
}

For Window, please use double backslash \ for the path.

Capture

@Resonanz

This comment has been minimized.

Copy link

commented Apr 15, 2019

It's hard to believe that I had to scroll thru about 50 comments to find the Windows double backslash requirement. Are the devs a bit dull? Do they not test on Windows?

@slzzz

This comment has been minimized.

Copy link

commented Apr 19, 2019

Thanks, it is very helpful.

@Red1Rashik

This comment has been minimized.

Copy link

commented Apr 21, 2019

For Windows // the user name will vary after C:\Users\

{
"cmd": ["C:\Users\user\AppData\Local\Programs\Python\Python37-32\pythonw.exe", "-u", "$file"],
"file_regex": "^[ ]File "(...?)", line ([0-9]*)",
"selector": "source.python"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.