It appears a bug has crept in the Python bundle for the Run Script (PyMate) command in TextMate ...
All appears well with the following version which correctly runs interactive Python scripts (requiring a dialog):
Version 1.5.4 (1324) [2006-11-02: REVISION 1324] Python 2.5.0 - PyMate r5848
uses the code:
# Save file, use tmp-file if there's no filepath. [[ -z "$TM_FILEPATH" ]] && TM_TMPFILE=$(mktemp -t pythonmate) : "${TM_FILEPATH:=$TM_TMPFILE}"; cat >"$TM_FILEPATH"
TPY=${TM_PYTHON:-pythonw}
"$TPY" "$TM_BUNDLE_SUPPORT/pymate.py" "$TM_FILEPATH"
rm -f "$TM_TMPFILE"
However the following (bleeding edge) version Version 1.5.4 (1360) [2007-02-13: REVISION 1360] PyMate r6190 running Python 2.5 (python)
uses the code (Ruby in a Python bundle???):
export TM_RUBY=$(which "${TM_RUBY:-ruby}") "$TM_RUBY" -- "$TM_BUNDLE_SUPPORT/PyMate/pymate.rb"
and only works for non-interactive Python scripts (I'm partly suprised it works at all).
Should this code change have happened between versions or is there a glitch.
Adios Harry.
------------------------------------------------------------------------ ---- Dr. Harold W. Schranz, Research Fellow, Computational Genomics Group Division of Molecular Bioscience, John Curtin School of Medical Research Australian National University, Canberra ACT 0200, Australia ------------------------------------------------------------------------ ----
Harold,
Can you post the specific error you are encountering? Do you scripts not run at all? Can you post a minimal example script that isn't working?
I am able to execute the following script without any problems using the latest PyMate:
#!/usr/bin/python x = input("Foo:") print x
We are using a single base class for all of the various *Mate (RubyMate, PerlMate, PyMate) commands, which is why you see ruby in there. Ruby doesn't run your python code; it just launches python with a custom exception handler and custom input/raw_input funcions, feeds the python code from the current document to the interpreter, and filters the output so it looks nice. You can imagine that we don't want to re-implement all of this for every language that needs a script runner. Rest assured, Ruby is just as capable of this as python.
– Alex
On Feb 15, 2007, at 9:08 PM, Harold Walter Schranz wrote: