Sublime Forum

Is there a tutorial for sublime?

#1

Hello,
I’d like to start learning python, so I chose Sublime text editor. Are there any tutorials available to get python working with Sublime? Thanks for any suggestions.

Win7 32
-adabo

0 Likes

#2

I installed IDLE python 2.7 and it works great. So now I’m curious if there is a way to use sublime the same way IDLE works? It would be nice to work only in sublime using the console at the bottom of the screen (ctrl + `).

0 Likes

#3

If you want to see your script’s output in Sublime’s output panel, you need to use a .sublime-build file. Sublime ships with one for Python and you can create your own too if you want. To run a script, it should be a matter of pressing F7.

More info:

sublimetext.info/docs/

0 Likes

#4

Thanks for the response, guillermooo. Well I can see that it’s just a bit beyond my skill level. I’ll see what I can do.

0 Likes

#5

Do you want to use Sublime’s python console as a python interactive interpreter? If that’s so, it’s very limited for general purpose usage… You’re going to be much better served with IPython.

What I was referring to is a way tu run the code you’re writing in Sublime Text without leaving the editor.

HTH

0 Likes

#6

I successfully added “C:\Python27” to the Path environment variable.

In the “Tools–>Build System” menu I chose “mypython_test” (arbitrary name for testing). I can write a simple script:

[code]x = 1
def func():
print ‘Function works.’

if x == 1:
print ‘If statement works.’
func()[/code]
And that works fine. But when I try to use:

raw_input('This is raw_input text')

, the “output panel” is blank and the console displays this:

Writing file C:\Python27\My Projects\pytest.py with encoding UTF-8 running command python from directory C:\Python27\My Projects exec: trying C:\Windows\system32\cmd.exe /A /S /C "python"

Using this custom build system:

# See http://www.sublimetext.com/docs/build for details build python lineNumberRegex ^(...*?):([0-9]*):?([0-9]*) showWhenFinished true workingDir $ProjectDir

0 Likes

#7

It seems that you’re using Sublime Text 1.

In any case, build systems are not meant to be used interactively, so I think you can’t use “raw_input”. You’re basically asking for input you can’t provide, so your script will wait forever and the ouput panel will remain empty.

0 Likes

#8

Oh I see what you’re saying. Too bad :frowning: The truth is I am using Sublime Text 1.4. Is there a newer one available? I’ve only just heard of Sublime recently, so I wouldn’t know.

In regards to interactive development, am I restricted to environments such as IDLE and IPython (another program I haven’t heard of) to handle such things?

Again, thanks for the consideration and support. I appreciate it very much :smile:

0 Likes

#9

There is a new version. It can be found here: sublimetext.com/2
It is an alpha but it is very stable. However, the build system is the same so same
issues as 1.4. ST2 is awesome so it is still worth looking at.

0 Likes