4

I used Sublime Text 2 in Ubuntu Linux and worked pretty fine.

Now, when I use it in Windows, i can't build anything. It appears "building" in the status bar in the bottom and then do nothing. I did a trivial test like building a print "hello world" in python build system and nothing happens.

I am missing anything? Btw: the python is in the System Path

André Freitas
  • 1,070
  • 1
  • 10
  • 13

2 Answers2

4

I'm not sure what the exact problem is, here are somethings you can try.

0. Recheck

Sublime text 2 just calls python -u $file on both linux and windows. I would first double check this command works in a new cmd window.

1. Patch exec.py

On Windows systems new windows opened by the build process are hidden. This stops GUIs and maybe the python terminal from appearing.

You can disable this patching Packages\Default\exec.py by commenting out line 33:

startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW

2. Indirectly calling python

Another option is to modify Packages/Python/Python.sublime-build so that it calls a bat file which then executes the python file. (this is what I am currently doing for .swf files)

3. Hardcoding Python path

Or, this is not ideal, you can try hard coding the python path into the build file like:

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

Hope one of the above works.

AnnanFay
  • 9,573
  • 15
  • 63
  • 86
  • Hi, so that makes sense now. The problem with build is that it really builds but not run the file :/ Thanks for your explanation. I couldn't find the exec.py in sublime text 2. Where it is? – André Freitas Oct 30 '12 at 09:39
  • @AndréFreitas I've updated the post with the exec.py path. Building does in fact run the file and does the same in windows and linux. If none of the above works I'm not sure how to fix it. – AnnanFay Oct 30 '12 at 21:12
  • Hi, the exec.py have a bug in Windows. I need to email sublime text 2. Thanks ;D – André Freitas Nov 03 '12 at 17:24
0

I'm having the same problem with

cmd: ["mongo","<","$file"]

and when I changed to

cmd: ["mongo $file"]

it worked.

Pang
  • 9,564
  • 146
  • 81
  • 122
Danilo
  • 41
  • 7