Greetings,
it seem that my TM_PYTHON variable is being ignored. I have it set to /Library/Frameworks/Python.framework/Versions/Current/bin/python
which executes like so:
============ ()[maye@alpha1 ~]$ /Library/Frameworks/Python.framework/Versions/Current/bin/python Enthought Python Distribution -- www.enthought.com Version: 7.3-2 (32-bit)
Python 2.7.3 |EPD 7.3-2 (32-bit)| (default, Apr 12 2012, 11:28:34) [GCC 4.0.1 (Apple Inc. build 5493)] on darwin Type "credits", "demo" or "enthought" for more information.
============
and then I wrote this little test script:
====== #!/usr/bin/env python import sys print sys.version ======
which, when executed via Cmd-R, returns:
==== 2.7.2 (default, Jun 20 2012, 16:23:33) [GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] ====
I also cross-checked what happens when I use env in the Terminal:
===== ()[maye@alpha1 ~]$ env python -c "import sys;print sys.version" 2.7.3 |EPD 7.3-2 (32-bit)| (default, Apr 12 2012, 11:28:34) [GCC 4.0.1 (Apple Inc. build 5493)] ()[maye@alpha1 ~]$ ====
So, it works in the Terminal fine, what do I have to do so that Textmate's Cmd-R picks up the right interpreter, WITHOUT changing the shebang (because the env-shebang is so common for online sources, it would be a major pain to always have to remove or change it) ?
Best regards, Michael
PS.: Running TM2 9373 on Mac OSX 10.8.2
On Feb 7, 2013, at 3:01 PM, K.-Michael Aye kmichael.aye@gmail.com wrote:
it seem that my TM_PYTHON variable is being ignored. I have it set to /Library/Frameworks/Python.framework/Versions/Current/bin/python
How are you setting it? I just use the system default for general TextMate, but I have several projects that use a [specific one][1], and the TM_PYTHON variable is being respected there.
[1]: http://projects.skurfer.com/posts/2012/virtualenv_textmate/
On 2013-02-07 20:10:43 +0000, Rob McBroom said:
On Feb 7, 2013, at 3:01 PM, K.-Michael Aye kmichael.aye@gmail.com wrote:
it seem that my TM_PYTHON variable is being ignored. I have it set to /Library/Frameworks/Python.framework/Versions/Current/bin/python
How are you setting it? I just use the system default for general TextMate, but I have several projects that use a [specific one][1], and the TM_PYTHON variable is being respected there.
I was not aware that there's more than 1 way to set it? I am using the Preferences->Variables to set TM_PYTHON .
On Feb 7, 2013, at 3:55 PM, K.-Michael Aye kmichael.aye@gmail.com wrote:
I was not aware that there's more than 1 way to set it?
It can be set in a `.tm_properties` file.
I am using the Preferences->Variables to set TM_PYTHON .
That should work. All of my project-specific TM_PYTHON variables are dependent on WORKON_HOME, which I’ve defined in the application-wide prefs.
What do you see if you type this in TextMate and hit ⌃R?
echo $TM_PYTHON
On 2013-02-08 00:30:06 +0000, Rob McBroom said:
On Feb 7, 2013, at 3:55 PM, K.-Michael Aye kmichael.aye@gmail.com wrote:
I was not aware that there's more than 1 way to set it?
It can be set in a `.tm_properties` file.
I am using the Preferences->Variables to set TM_PYTHON .
That should work. All of my project-specific TM_PYTHON variables are dependent on WORKON_HOME, which Iâve defined in the application-wide prefs.
What do you see if you type this in TextMate and hit âR?
echo $TM_PYTHON
I guess you meant to save that as a script file ***.sh and then hit Cmd-R? In that case I get:
/Library/Frameworks/Python.framework/Versions/Current/bin/python
which I guess makes it even more puzzling, right? :(
On Thu, Feb 7, 2013 at 8:13 PM, K.-Michael Aye kmichael.aye@gmail.comwrote:
I guess you meant to save that as a script file ***.sh and then hit Cmd-R? In that case I get:
Press Ctrl-R on the same line that you have: echo $TM_PYTHON The line is passed to the shell, and the results of the command are appended on the lines beneath it. Also useful is to execute "env" in this way. It'll show all the variables available to TextMate and their values.
On 2013-02-08 02:30:28 +0000, Craig Hess said:
On Thu, Feb 7, 2013 at 8:13 PM, K.-Michael Aye kmichael.aye@gmail.com wrote: I guess you meant to save that as a script file ***.sh and then hit Cmd-R? In that case I get:
Press Ctrl-R on the same line that you have: echo $TM_PYTHON The line is passed to the shell, and the results of the command are appended on the lines beneath it. Also useful is to execute "env" in this way. It'll show all the variables available to TextMate and their values.
I see, ok, did that, still the same:
echo $TM_PYTHON /Library/Frameworks/Python.framework/Versions/Current/bin/python
Summarizing the weirdness:
When I do NOT have a shebang, it uses the above linked interpreter. ONLY when I use ---- #!/usr/bin/env python ---- as shebang, the WRONG interpreter (OSX default Python) is being used, despite the fact that when I am using "/usr/bin/env python" in a Terminal I again get the one I want:
(develop+)[maye@alpha1 .../luna1disk/src/diviner]$ /usr/bin/env python Enthought Python Distribution -- www.enthought.com Version: 7.3-2 (32-bit)
Python 2.7.3 |EPD 7.3-2 (32-bit)| (default, Apr 12 2012, 11:28:34) [GCC 4.0.1 (Apple Inc. build 5493)] on darwin Type "credits", "demo" or "enthought" for more information.
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
On Feb 8, 2013, at 8:13 AM, K.-Michael Aye kmichael.aye@gmail.com wrote:
[…] When I do NOT have a shebang, it uses the above linked interpreter. ONLY when I use
#!/usr/bin/env python
as shebang, the WRONG interpreter (OSX default Python) is being used, despite the fact that when I am using "/usr/bin/env python" in a Terminal I again get the one I want […]
That is because the above shebang will use python found via PATH and you have likely altered your PATH for your shell so that the location of your custom installed python is listed before the system’s location.
You can alter PATH for TextMate in the same way, though I’m considering letting the script runners ignore shebang when TM_«interpreter» is set — it is likely more practical (despite a little wrong, e.g. your shebang could be broken, and you would never notice while developing in TextMate, because it is ignored).
On 2013-02-08 08:22:45 +0000, Allan Odgaard said:
On Feb 8, 2013, at 8:13 AM, K.-Michael Aye kmichael.aye@gmail.com wrote:
[…] When I do NOT have a shebang, it uses the above linked interpreter. ONLY when I use
#!/usr/bin/env python
as shebang, the WRONG interpreter (OSX default Python) is being used, despite the fact that when I am using "/usr/bin/env python" in a Terminal I again get the one I want […]
That is because the above shebang will use python found via PATH and you have likely altered your PATH for your shell so that the location of your custom installed python is listed before the system’s location.
You can alter PATH for TextMate in the same way, though I’m considering letting the script runners ignore shebang when TM_«interpreter» is set — it is likely more practical (despite a little wrong, e.g. your shebang could be broken, and you would never notice while developing in TextMate, because it is ignored).
Thank you, Allan, that connection between the env shebang and the PATH variable I was missing. Added PATH to Textmate's variables and now everything works as expected.
Cheers, Michael
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate