[TxMt] Python bundle doesn't see modules

michal owsiak michal.owsiak at gmail.com
Sat Jan 1 18:02:33 UTC 2011


Hi there,

I have Python related issue within TextMate. I am trying to start Python
script directly from TextMate, but it fails.

Here comes the output from Terminal:

michalo:/Users/michalo/test> python simple.py
One
Two
michalo:/Users/michalo/test> cat simple.py
#!/usr/bin/python

import xml.etree.ElementTree as ET

def main():
element = ET.XML("<root><child>One</child><child>Two</child></root>")
for subelement in element:
print subelement.text

if __name__ == "__main__":
# Someone is launching this directly
main()

michalo:/Users/michalo/test> python simple.py
One
Two
michalo:/Users/michalo/test> python --version
Python 2.6.1

However, if I use Python bundle to start this script directly from the
TextMate (Bundles -> Python -> Run script) I get following error:

ImportError: 'No module named etree.ElementTree'

module body in xml.py at line 3
import xml.etree.ElementTree as ET
copy output
Program exited with code #1 after 0.19 seconds.

If I start it from TextMate Bundles -> Python -> Run script (Terminal)), I
am getting following error:

Traceback (most recent call last):
  File "/Users/michalo/Documents/work_files/public/notes/python/xml.py",
line 3, in <module>
    import xml.etree.ElementTree as ET
  File "/Users/michalo/Documents/work_files/public/notes/python/xml.py",
line 3, in <module>
    import xml.etree.ElementTree as ET
ImportError: No module named etree.ElementTree
michalo:/Users/michalo/Documents/work_files/public/notes/python>

Do you know what can be the source of the issue?

That's what I get from the Terminal windows (when I try to get Python
version):

michalo:/Users/michalo/test> which python
/usr/bin/python
michalo:/Users/michalo/test> python --version
Python 2.6.1
michalo:/Users/michalo/test>

And you can find attached screen shoot from text mate. I have created simple
text file:

which python
python --version

And executed it with: Bundles -> Shell Scripts -> Run script

Does anyone have an idea what's wrong here?

Cheers

Michal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20110101/6aa5526e/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen shot 2010-12-30 at 12.02.11 PM.png
Type: image/png
Size: 45926 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20110101/6aa5526e/attachment-0001.png>


More information about the textmate mailing list