Using Sublime Text 2 with Portable Python
Question: I have portable python and portable sublime text installed on a flash drive. I
edited the python-build file so that it would use portable python to run the
programs but it doesn't print anything into the sublime text window, it just
opens up a command prompt window which immediately closes if the program stops
or has an error. Is there anyway to make the output pop up in sublime text?
Ideally, I would like to make this usable on all windows computers so I can
keep my workflow portable!

Thanks!


Answer: I ran into the same problem and after a bit of troubleshooting, here is my
solution:

1) Use the build system:

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

This build will open your program in Python Portable. Instead of specifying
your flash drive letter, using "\" will go to the path relative to the root of
the current drive.

2) At the end of your code add the following line to prevent force closing:

    
    
    os.system("pause")
    

Also, don't forget to import the "os" module:

    
    
    import os
    

