[TxMt] Re: Python testing....
Tommy Allen
tommy at tweek.us
Tue Jun 1 03:14:06 UTC 2010
What I do is test for TM_APP_PATH in os.environ:
import os
if __name__ == '__main__':
if 'TM_APP_PATH' in os.environ:
print 'Hello Textmate!'
else:
print 'Hello Terminal!'
If you are working in a project, you could set your own environment variable
for the project and test for it instead:
import os
import sys
if __name__ == '__main__':
if 'PY_ARGV' in os.environ:
argv = os.environ.get('PY_ARGV').split()
else:
argv = sys.argv[1:]
do_something_with(argv)
On Mon, May 31, 2010 at 9:08 PM, Brian H <binarynomad at gmail.com> wrote:
> Hi there,
>
> I had a quick question on the Textmate "Python -> Run Script" command.
> Since I mostly write command line utilities, I pass command line arguments
> to my scripts on a regular basis.
>
> Is there a way to test your python script (CMD-R) and have Textmate
> populate sys.argv[:] for the script to use? Either via a dialog box, a TM
> Variable, etc?
>
> Thanks for any help,
>
> ----
> Brian H
> binarynomad at gmail.com
> http://www.binarynomad.com
>
>
> _______________________________________________
> textmate mailing list
> textmate at lists.macromates.com
> http://lists.macromates.com/listinfo/textmate
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20100531/9f44961f/attachment.html>
More information about the textmate
mailing list