Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #3215 > unrolled thread

[Mac OSX] TextWrangler "run" command not working properly

Started byFabio <oakwood@email.it>
First post2011-04-14 22:52 +0200
Last post2011-04-15 05:57 -0400
Articles 6 — 4 participants

Back to article view | Back to comp.lang.python


Contents

  [Mac OSX] TextWrangler "run" command not working properly Fabio <oakwood@email.it> - 2011-04-14 22:52 +0200
    Re: TextWrangler "run" command not working properly Jon Clements <joncle@googlemail.com> - 2011-04-14 14:01 -0700
      Re: TextWrangler "run" command not working properly Ernest Obusek <ernest@willowfalls.net> - 2011-04-14 17:14 -0400
        Re: TextWrangler "run" command not working properly Fabio <oakwood@email.it> - 2011-04-17 14:07 +0200
      Re: TextWrangler "run" command not working properly Fabio <oakwood@email.it> - 2011-04-15 10:51 +0200
        Re: TextWrangler "run" command not working properly Brian Blais <bblais@bryant.edu> - 2011-04-15 05:57 -0400

#3215 — [Mac OSX] TextWrangler "run" command not working properly

FromFabio <oakwood@email.it>
Date2011-04-14 22:52 +0200
Subject[Mac OSX] TextWrangler "run" command not working properly
Message-ID<oakwood-DAC806.22525414042011@news.free.fr>
Hi to all,
I have troubles with TextWrangler "run" command in the "shebang" (#!) 
menu.
I am on MacOSX 10.6.7.
I have the "built-in" Python2.5 which comes installed by "mother Apple".
Then I installed Python2.6, and left 2.5 untouched (I was suggested to 
leave it on the system, since "something might need it").

I ran the "Update Shell Profile.command", and now if I launch "python" 
in the terminal it happily launches the 2.6 version.
Then I installed some libraries (scipy and matplotlib) on this newer 2.6 
version.
They work, and everything is fine.

Then, I started to use TexWrangler, and I wanted to use the "shebang" 
menu, and "run" command.
I have the "#! first line" pointing to the 2.6 version.
It works fine, as long as I don't import the libraries, in which case it 
casts an error saying:

ImportError: No module named scipy

Maybe for some reason it points to the old 2.5 version. 
But I might be wrong and the problem is another...

I copy here the first lines in the terminal window if i give the "run in 
terminal" command


Last login: Thu Apr 14 22:38:26 on ttys000
Fabio-Mac:~ fabio$ 
/var/folders/BS/BSS71XvjFKiJPH3Wqtx90k+++TM/-Tmp-/Cleanup\ At\ 
Startup/untitled\ text-324506443.860.command ; exit;
Traceback (most recent call last):
  File "/Users/fabio/Desktop/test.py", line 3, in <module>
    import scipy as sp
ImportError: No module named scipy
logout

[Process completed]

where the source (test.py) contains just:

#!/usr/bin/python2.6

import scipy as sp

print "hello world"


Any clue?

Thanks

Fabio

[toc] | [next] | [standalone]


#3216 — Re: TextWrangler "run" command not working properly

FromJon Clements <joncle@googlemail.com>
Date2011-04-14 14:01 -0700
SubjectRe: TextWrangler "run" command not working properly
Message-ID<382709dd-5e3f-4b07-a642-4ce141ef442b@18g2000prd.googlegroups.com>
In reply to#3215
On Apr 14, 9:52 pm, Fabio <oakw...@email.it> wrote:
> Hi to all,
> I have troubles with TextWrangler "run" command in the "shebang" (#!)
> menu.
> I am on MacOSX 10.6.7.
> I have the "built-in" Python2.5 which comes installed by "mother Apple".
> Then I installed Python2.6, and left 2.5 untouched (I was suggested to
> leave it on the system, since "something might need it").
>
> I ran the "Update Shell Profile.command", and now if I launch "python"
> in the terminal it happily launches the 2.6 version.
> Then I installed some libraries (scipy and matplotlib) on this newer 2.6
> version.
> They work, and everything is fine.
>
> Then, I started to use TexWrangler, and I wanted to use the "shebang"
> menu, and "run" command.
> I have the "#! first line" pointing to the 2.6 version.
> It works fine, as long as I don't import the libraries, in which case it
> casts an error saying:
>
> ImportError: No module named scipy
>
> Maybe for some reason it points to the old 2.5 version.
> But I might be wrong and the problem is another...
>
> I copy here the first lines in the terminal window if i give the "run in
> terminal" command
>
> Last login: Thu Apr 14 22:38:26 on ttys000
> Fabio-Mac:~ fabio$
> /var/folders/BS/BSS71XvjFKiJPH3Wqtx90k+++TM/-Tmp-/Cleanup\ At\
> Startup/untitled\ text-324506443.860.command ; exit;
> Traceback (most recent call last):
>   File "/Users/fabio/Desktop/test.py", line 3, in <module>
>     import scipy as sp
> ImportError: No module named scipy
> logout
>
> [Process completed]
>
> where the source (test.py) contains just:
>
> #!/usr/bin/python2.6
>
> import scipy as sp
>
> print "hello world"
>
> Any clue?
>
> Thanks
>
> Fabio

http://www.velocityreviews.com/forums/t570137-textwrangler-and-new-python-version-mac.html
?

[toc] | [prev] | [next] | [standalone]


#3218 — Re: TextWrangler "run" command not working properly

FromErnest Obusek <ernest@willowfalls.net>
Date2011-04-14 17:14 -0400
SubjectRe: TextWrangler "run" command not working properly
Message-ID<mailman.371.1302815698.9059.python-list@python.org>
In reply to#3216
I'm not a python expert, but you might trying running 'print sys.path' inside your script and run that from TextWrangler to see where it's looking for modules.

- Ernest


On Apr 14, 2011, at 5:01 PM, Jon Clements wrote:

> On Apr 14, 9:52 pm, Fabio <oakw...@email.it> wrote:
>> Hi to all,
>> I have troubles with TextWrangler "run" command in the "shebang" (#!)
>> menu.
>> I am on MacOSX 10.6.7.
>> I have the "built-in" Python2.5 which comes installed by "mother Apple".
>> Then I installed Python2.6, and left 2.5 untouched (I was suggested to
>> leave it on the system, since "something might need it").
>> 
>> I ran the "Update Shell Profile.command", and now if I launch "python"
>> in the terminal it happily launches the 2.6 version.
>> Then I installed some libraries (scipy and matplotlib) on this newer 2.6
>> version.
>> They work, and everything is fine.
>> 
>> Then, I started to use TexWrangler, and I wanted to use the "shebang"
>> menu, and "run" command.
>> I have the "#! first line" pointing to the 2.6 version.
>> It works fine, as long as I don't import the libraries, in which case it
>> casts an error saying:
>> 
>> ImportError: No module named scipy
>> 
>> Maybe for some reason it points to the old 2.5 version.
>> But I might be wrong and the problem is another...
>> 
>> I copy here the first lines in the terminal window if i give the "run in
>> terminal" command
>> 
>> Last login: Thu Apr 14 22:38:26 on ttys000
>> Fabio-Mac:~ fabio$
>> /var/folders/BS/BSS71XvjFKiJPH3Wqtx90k+++TM/-Tmp-/Cleanup\ At\
>> Startup/untitled\ text-324506443.860.command ; exit;
>> Traceback (most recent call last):
>>   File "/Users/fabio/Desktop/test.py", line 3, in <module>
>>     import scipy as sp
>> ImportError: No module named scipy
>> logout
>> 
>> [Process completed]
>> 
>> where the source (test.py) contains just:
>> 
>> #!/usr/bin/python2.6
>> 
>> import scipy as sp
>> 
>> print "hello world"
>> 
>> Any clue?
>> 
>> Thanks
>> 
>> Fabio
> 
> http://www.velocityreviews.com/forums/t570137-textwrangler-and-new-python-version-mac.html
> ?
> -- 
> http://mail.python.org/mailman/listinfo/python-list

[toc] | [prev] | [next] | [standalone]


#3390 — Re: TextWrangler "run" command not working properly

FromFabio <oakwood@email.it>
Date2011-04-17 14:07 +0200
SubjectRe: TextWrangler "run" command not working properly
Message-ID<oakwood-751B61.14072017042011@news.free.fr>
In reply to#3218
In article <mailman.371.1302815698.9059.python-list@python.org>,
 Ernest Obusek <ernest@willowfalls.net> wrote:

> I'm not a python expert, but you might trying running 'print sys.path' inside 
> your script and run that from TextWrangler to see where it's looking for 
> modules.
> 
> - Ernest




Hi Ernst, Hi Brian,
Thank you for your answers!
With the "#!/usr/bin/env python" shebang line now it works!
I also had more insights running "print sys.path".

I still have to understand how comes, even with this "env trick" 
TextWrangler isn't able to "find the libraries" if I run a script "in 
TextWrangler". It only works fine if I use the "Run in Terminal" method.
Do you have more details about how TextWrangler manages these commands?
Which are its defalut locations?

Cheers,

Fabio

> 
> 
> On Apr 14, 2011, at 5:01 PM, Jon Clements wrote:
> 
> > On Apr 14, 9:52 pm, Fabio <oakw...@email.it> wrote:
> >> Hi to all,
> >> I have troubles with TextWrangler "run" command in the "shebang" (#!)
> >> menu.
> >> I am on MacOSX 10.6.7.
> >> I have the "built-in" Python2.5 which comes installed by "mother Apple".
> >> Then I installed Python2.6, and left 2.5 untouched (I was suggested to
> >> leave it on the system, since "something might need it").
> >> 
> >> I ran the "Update Shell Profile.command", and now if I launch "python"
> >> in the terminal it happily launches the 2.6 version.
> >> Then I installed some libraries (scipy and matplotlib) on this newer 2.6
> >> version.
> >> They work, and everything is fine.
> >> 
> >> Then, I started to use TexWrangler, and I wanted to use the "shebang"
> >> menu, and "run" command.
> >> I have the "#! first line" pointing to the 2.6 version.
> >> It works fine, as long as I don't import the libraries, in which case it
> >> casts an error saying:
> >> 
> >> ImportError: No module named scipy
> >> 
> >> Maybe for some reason it points to the old 2.5 version.
> >> But I might be wrong and the problem is another...
> >> 
> >> I copy here the first lines in the terminal window if i give the "run in
> >> terminal" command
> >> 
> >> Last login: Thu Apr 14 22:38:26 on ttys000
> >> Fabio-Mac:~ fabio$
> >> /var/folders/BS/BSS71XvjFKiJPH3Wqtx90k+++TM/-Tmp-/Cleanup\ At\
> >> Startup/untitled\ text-324506443.860.command ; exit;
> >> Traceback (most recent call last):
> >>   File "/Users/fabio/Desktop/test.py", line 3, in <module>
> >>     import scipy as sp
> >> ImportError: No module named scipy
> >> logout
> >> 
> >> [Process completed]
> >> 
> >> where the source (test.py) contains just:
> >> 
> >> #!/usr/bin/python2.6
> >> 
> >> import scipy as sp
> >> 
> >> print "hello world"
> >> 
> >> Any clue?
> >> 
> >> Thanks
> >> 
> >> Fabio
> > 
> > http://www.velocityreviews.com/forums/t570137-textwrangler-and-new-python-ve
> > rsion-mac.html
> > ?
> > -- 
> > http://mail.python.org/mailman/listinfo/python-list

[toc] | [prev] | [next] | [standalone]


#3255 — Re: TextWrangler "run" command not working properly

FromFabio <oakwood@email.it>
Date2011-04-15 10:51 +0200
SubjectRe: TextWrangler "run" command not working properly
Message-ID<oakwood-239C29.10512015042011@news.free.fr>
In reply to#3216
In article 
<382709dd-5e3f-4b07-a642-4ce141ef442b@18g2000prd.googlegroups.com>,
 Jon Clements <joncle@googlemail.com> wrote:

> http://www.velocityreviews.com/forums/t570137-textwrangler-and-new-python-vers
> ion-mac.html

Thank you for the reply Jon.
I saw the post in velocityreviews. Unfortunately it doesn't solve my 
problem.

Cheers

[toc] | [prev] | [next] | [standalone]


#3266 — Re: TextWrangler "run" command not working properly

FromBrian Blais <bblais@bryant.edu>
Date2011-04-15 05:57 -0400
SubjectRe: TextWrangler "run" command not working properly
Message-ID<mailman.393.1302865048.9059.python-list@python.org>
In reply to#3255
Hello Fabio You have two versions of 2.6 on your system.  

On Apr 15, 2011, at 4:51 AM, Fabio wrote:
> I have the "built-in" Python2.5 which comes installed by "mother Apple".


My OSX comes with 2.3, 2.5, and 2.6.  :)  These are under:

/System/Library/Frameworks/Python.framework/Versions/
^^^^^^^^^

the ones you installed are under:

/Library/Frameworks/Python.framework/Versions/

I can reproduce this problem on my system, because /usr/bin/python2.6 points to the system version.  There is an easy solution:

#!/usr/bin/env python

will work, or, 

#!/usr/local/bin/python

it's better to use the former, as it will work even as you change versions, etc...  You should avoid using the shebang with a *specific* python version.  just use #!/usr/bin/env python



				bb


-- 
Brian Blais
bblais@bryant.edu
http://web.bryant.edu/~bblais
http://bblais.blogspot.com/


[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web