Google
 
Web unafbapune.blogspot.com

Sunday, November 04, 2012

 

Running QSTK from TextMate/Sublime Text 2 in OSX

Assuming QSTK has been installed

Sublime Text 2

Edit the Sublime's Python build file at:

  ~/Library/Application Support/Sublime Text 2/Packages/Python/Python.sublime-build
adding the QSTK environment variables. The file would then end up containing something like:
{
    "cmd": ["python", "-u", "$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python",

    "env":
    {
        "PATH": "/opt/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/upune/QSTK/Bin",
        "PYTHONPATH": ":/Users/upune/QSTK:/Users/upune/QSTK/Bin",
        "QS": "/Users/upune/QSTK",
        "QSDATA": "/Users/upune/QSTK/QSData",
        "HOSTNAME": "5855pns93223.nag.nznmba.com",
        "QSDATAPROCESSED": "/Users/upune/QSTK/QSData/Processed",
        "QSDATATMP": "/Users/upune/QSTK/QSData/Tmp",
        "QSBIN": "/Users/upune/QSTK/Bin",
        "QSSCRATCH": "/Users/upune/QSTK/QSData/Scratch",
        "CACHESTALLTIME": "12"
    }
}
The environment variables that need to be defined can be found in the file:
    ~/QSTK/local.sh 
Now one can execute those Python scripts under
    ~/QSTK/Exampls/Basic/
with the usual Command-B shortcut key in Sublime Text 2.

TextMate

In TextMate, however, these environment variables would need to be added at

    TextMate > Preferences > Shell Variables
The Python scripts can then be executed with the usual Command-R shortcut key in TextMate.

Comments:
Hi,

I use Sublime Text 2 in ubuntu. I tired to set up QSTK according to your descripton but i still get the error:

"ImportError: No module named qstkutil.qsdateutil"

Any ideas what could be wrong?

Thanks in advance.

MY code:

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


"env":
{
"QS": "/HOME/QSTK",
"QSDATA":"/HOME/QSTK/QS/QSData",
"HOSTNAME":"hostname",
"QSDATAPROCESSED":"/HOME/QSTK/QS/QSDATA/Processed",
"QSDATATMP":"/HOME/QSTK/QS/Tmp",
"QSBIN":"/HOME/QSTK/QS/Bin",
"PYTHONPATH":"$PYTHONPATH:$QS:$QSBIN",
"PATH":"$PATH:$QSBIN",
"QSSCRATCH":"$QSDATA/Scratch",
"CACHESTALLTIME":"12",
"REMOTEUSER":"tb34",
"REMOTEHOST":"gekko.cc.gatech.edu",
"REMOTEHOME":"/nethome/$REMOTEUSER",
"PYTHONPATH":"$PYTHONPATH:/usr/local/lib/NAG/",
"NAG_KUSARI_FILE":"/usr/local/lib/NAG/nagkey.txt"
}
}

 
Have you tried expanding the full paths for the env variable definitions, instead of using variables such as $PYTHONPATH, $QS, etc ?
 
Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?