Re: BBEdit & Python

2013-02-11 Thread Bruce Van Allen

On 2013-02-11 at 2:31 PM, n1mie.c...@gmail.com (Chip G.) wrote:

OK, a variation on this worked. When I changed it to a 
legitimate path on my system it worked.


#!/sw/bin/python3.2

Now that's working. But since the examples I had from the 
author didn't include those, I wonder why I can't get it to 
work without.


I'm not sure what you mean by working "without", but there's a 
key thing here that I hope you get.


That first line starting the #! should have a valid path to the 
interpeter you want to execute the file with. It's not the path 
of the script file itself, which I think you said in an earlier post.


If this isn't familiar, search Wikipedia or somewhere for 
"shebang line".


Study what Maaerten said; and I concur with Herbert's guess 
about why your script worked with 'sw/bin/python3.2' as the 
shebang path. Lee gave you the way to find the paths to ALL of 
your Python installs.


If you wanted, by the way, to test your script in different 
versions of Python, you can stack up several shebang lines, and 
change which one is on the top line to see how the script 
performs with your different versions. You could even use 
BBEdit's "Move Line Up" command to quickly make the change.


HTH.




Best Regards,

  - Bruce

_bruce__van_allen__santa_cruz_ca_

--
--
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.

To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at

If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.

Follow @bbedit on Twitter: 

--- 
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: BBEdit & Python

2013-02-11 Thread Herbert Schulz

On Feb 11, 2013, at 4:31 PM, Chip G.  wrote:

> On Feb 11, 2013, at 16:12, Maarten Sneep wrote:
> 
>> As a last resort, you could use the full path to python:
>> 
>> #!/usr/local/bin/python3
> 
> OK, a variation on this worked. When I changed it to a legitimate path on my 
> system it worked.
> 
> #!/sw/bin/python3.2
> 
> Now that's working. But since the examples I had from the author didn't 
> include those, I wonder why I can't get it to work without.
> 
> Thanks again,
> 
> 
> --
>Chip
> 

Howdy,

If I had to guess I would assume /sw/bin was placed near the start of the PATH 
so /sw/bin/python (which most likely is a symbolic link to python3.2) was found 
before the other versions of python in other items along the PATH.

Good Luck,

Herb Schulz
(herbs at wideopenwest dot com)



-- 
-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at

If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: BBEdit & Python

2013-02-11 Thread Chip G.
On Feb 11, 2013, at 16:12, Maarten Sneep wrote:

> As a last resort, you could use the full path to python:
> 
> #!/usr/local/bin/python3

OK, a variation on this worked. When I changed it to a legitimate path on my 
system it worked.

#!/sw/bin/python3.2

Now that's working. But since the examples I had from the author didn't include 
those, I wonder why I can't get it to work without.

Thanks again,


--
Chip

-- 
-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at

If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: BBEdit & Python

2013-02-11 Thread Maarten Sneep

On 11 feb. 2013, at 23:13, "Chip G."  wrote:

> On Feb 11, 2013, at 16:12, Maarten Sneep wrote:
> 
>> On 11 feb. 2013, at 21:25, "Chip G."  wrote:
>> 
>>> I'm trying to learn Python. I have a book that is helping me along. I'd 
>>> like to use BBEdit as my editor, but I'm having some issues. Part of this 
>>> is an Apple/Fink thing. Part of the problem is that the version of python 
>>> get if I run using 'python' is old (v2.7.1). If I force paths I can get 
>>> v2.7.3 or v3.2.3. As near as I can tell, BBEdit uses the version as if I 
>>> typed 'python' which doesn't work properly with the code in the book. Even 
>>> if I download the authors copy directly. So I'm trying to find a way to 
>>> force BBEdit to use a specific version 2.7.3 or 3.2.3 vice the 2.7.1 it 
>>> keeps preferring. Any ideas?
>> 
>> What's the first line of your script?
> 
> It starts with a line with a '#' and the name of the file. Next after that is:

That is just a plain comment.

> from tkinter import *
> 
> Which works under python 3.2 but not in python 2.7 unless I make it Tkinter.

As expected.

> If I do
> $python myscript.py
> It uses 2.7.1.
> 
> If I do
> $python2.7 myscript.py
> It uses 2.7.3.
> 
> If I do
> $python3.2 myscript.py
> It uses 3.2.3.

So you have three python interpreters in your path. Don't worry, I think I have 
5 or so.

> If I run it from BBEdit it runs behaves the same as the first example. My 
> script, which is calling for Tk to draw a very basic window, doesn't work 
> under 2.7.1 but does under 2.7.3 and 3.2.3. I can test this from the command 
> line perfectly. What I need is a way to control what BBEdit is using.
> 
>> If python 2.7.1 rejects the code, then I assume that the code is written for 
>> python 3 (which is a sensible version to learn these days).
> 
> Nope, works under 2.7.3. And if your statement is true it still doesn't 
> explain how to force BBEdit to use 3.

It does, read again. Right now there is nothing in the file that tells BBEdit 
which python to run, so it uses the plain default ("python", which resolves to 
2.7.1 on your machine).

> 
>> You can try to set the first line to:
>> 
>> #!/usr/bin/env python3
> 
> That looks like bash script, will that work at the beginning of a python 
> script?

That magic #! combination tells the shell to look inside the file to find the 
correct interpreter. It will run /usr/bin/env with the argument 'python3'. This 
is a fancy way of saying that you want your environment to figure out which 
interpreter to run. Works with bash, python, perl, ...

See page 314 in the BBEdit user manual.

> Tried it and BBEdit gave me this error:
> "env: python3: No such file or directory"

So it is working. No, really: BBEdit ran the env tool, but the env tool did not 
find python3. You could try python2.7 instead, or python3.2, but I'd rather get 
python3 working correctly.

What does "which python3" in the terminal say? The python3 command is a generic 
description of, well, python3, without tying you directly to python 3.2.3 or 
even 3.2.x

>> If that doesn't work, try to be more specific (open a terminal, and see 
>> which versions of python are available, typing python and pressing the 
>> tab-key should provide some options).
> 
> See above. 

And now with the full paths.

> 
>> As a last resort, you could use the full path to python:
>> 
>> #!/usr/local/bin/python3
> 
> No, still getting the same errors (tried forcing 2.7.3 too, no dice).

(did you replace the hard-coded path with the output from "which python3.2"?)

Maarten

-- 
-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at

If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: BBEdit & Python

2013-02-11 Thread Lee Hinde

On Feb 11, 2013, at 2:13 PM, "Chip G."  wrote:

> On Feb 11, 2013, at 16:12, Maarten Sneep wrote:
> 
>> On 11 feb. 2013, at 21:25, "Chip G."  wrote:
>> 
>>> I'm trying to learn Python. I have a book that is helping me along. I'd 
>>> like to use BBEdit as my editor, but I'm having some issues. Part of this 
>>> is an Apple/Fink thing. Part of the problem is that the version of python 
>>> get if I run using 'python' is old (v2.7.1). If I force paths I can get 
>>> v2.7.3 or v3.2.3. As near as I can tell, BBEdit uses the version as if I 
>>> typed 'python' which doesn't work properly with the code in the book. Even 
>>> if I download the authors copy directly. So I'm trying to find a way to 
>>> force BBEdit to use a specific version 2.7.3 or 3.2.3 vice the 2.7.1 it 
>>> keeps preferring. Any ideas?
>> 
>> What's the first line of your script?
> 
> It starts with a line with a '#' and the name of the file. Next after that is:
> 
> from tkinter import *
> 
> Which works under python 3.2 but not in python 2.7 unless I make it Tkinter.
> 
> If I do
> $python myscript.py
> It uses 2.7.1.
> 
> If I do
> $python2.7 myscript.py
> It uses 2.7.3.
> 
> If I do
> $python3.2 myscript.py
> It uses 3.2.3.
> 
> If I run it from BBEdit it runs behaves the same as the first example. My 
> script, which is calling for Tk to draw a very basic window, doesn't work 
> under 2.7.1 but does under 2.7.3 and 3.2.3. I can test this from the command 
> line perfectly. What I need is a way to control what BBEdit is using.
> 
>> If python 2.7.1 rejects the code, then I assume that the code is written for 
>> python 3 (which is a sensible version to learn these days).
> 
> Nope, works under 2.7.3. And if your statement is true it still doesn't 
> explain how to force BBEdit to use 3.
> 
>> You can try to set the first line to:
>> 
>> #!/usr/bin/env python3
> 
> That looks like bash script, will that work at the beginning of a python 
> script?
> 
> Tried it and BBEdit gave me this error:
> "env: python3: No such file or directory"
> 
>> If that doesn't work, try to be more specific (open a terminal, and see 
>> which versions of python are available, typing python and pressing the 
>> tab-key should provide some options).
> 
> See above.
> 
>> As a last resort, you could use the full path to python:
>> 
>> #!/usr/local/bin/python3
> 
> No, still getting the same errors (tried forcing 2.7.3 too, no dice).
> 
>> I'm sure others will provide the correct method for getting BBEdit to 
>> recognize your scripts and finding the appropriate interpreter.
> 
> I hope so ... :)
> 
> 
> --
>Chip
> 

try this in terminal:

which python3

then use the resulting path as above.


-- 
-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at

If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: BBEdit & Python

2013-02-11 Thread Chip G.
On Feb 11, 2013, at 16:12, Maarten Sneep wrote:

> On 11 feb. 2013, at 21:25, "Chip G."  wrote:
> 
>> I'm trying to learn Python. I have a book that is helping me along. I'd like 
>> to use BBEdit as my editor, but I'm having some issues. Part of this is an 
>> Apple/Fink thing. Part of the problem is that the version of python get if I 
>> run using 'python' is old (v2.7.1). If I force paths I can get v2.7.3 or 
>> v3.2.3. As near as I can tell, BBEdit uses the version as if I typed 
>> 'python' which doesn't work properly with the code in the book. Even if I 
>> download the authors copy directly. So I'm trying to find a way to force 
>> BBEdit to use a specific version 2.7.3 or 3.2.3 vice the 2.7.1 it keeps 
>> preferring. Any ideas?
> 
> What's the first line of your script?

It starts with a line with a '#' and the name of the file. Next after that is:

from tkinter import *

Which works under python 3.2 but not in python 2.7 unless I make it Tkinter.

If I do
$python myscript.py
It uses 2.7.1.

If I do
$python2.7 myscript.py
It uses 2.7.3.

If I do
$python3.2 myscript.py
It uses 3.2.3.

If I run it from BBEdit it runs behaves the same as the first example. My 
script, which is calling for Tk to draw a very basic window, doesn't work under 
2.7.1 but does under 2.7.3 and 3.2.3. I can test this from the command line 
perfectly. What I need is a way to control what BBEdit is using.

> If python 2.7.1 rejects the code, then I assume that the code is written for 
> python 3 (which is a sensible version to learn these days).

Nope, works under 2.7.3. And if your statement is true it still doesn't explain 
how to force BBEdit to use 3.

> You can try to set the first line to:
> 
> #!/usr/bin/env python3

That looks like bash script, will that work at the beginning of a python script?

Tried it and BBEdit gave me this error:
"env: python3: No such file or directory"

> If that doesn't work, try to be more specific (open a terminal, and see which 
> versions of python are available, typing python and pressing the tab-key 
> should provide some options).

See above.

> As a last resort, you could use the full path to python:
> 
> #!/usr/local/bin/python3

No, still getting the same errors (tried forcing 2.7.3 too, no dice).

> I'm sure others will provide the correct method for getting BBEdit to 
> recognize your scripts and finding the appropriate interpreter.

I hope so ... :)


--
Chip

-- 
-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at

If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: BBEdit & Python

2013-02-11 Thread Maarten Sneep

On 11 feb. 2013, at 21:25, "Chip G."  wrote:

> I'm trying to learn Python. I have a book that is helping me along. I'd like 
> to use BBEdit as my editor, but I'm having some issues. Part of this is an 
> Apple/Fink thing. Part of the problem is that the version of python get if I 
> run using 'python' is old (v2.7.1). If I force paths I can get v2.7.3 or 
> v3.2.3. As near as I can tell, BBEdit uses the version as if I typed 'python' 
> which doesn't work properly with the code in the book. Even if I download the 
> authors copy directly. So I'm trying to find a way to force BBEdit to use a 
> specific version 2.7.3 or 3.2.3 vice the 2.7.1 it keeps preferring. Any ideas?

What's the first line of your script?

If python 2.7.1 rejects the code, then I assume that the code is written for 
python 3 (which is a sensible version to learn these days).

You can try to set the first line to:

#!/usr/bin/env python3

If that doesn't work, try to be more specific (open a terminal, and see which 
versions of python are available, typing python and pressing the tab-key should 
provide some options).

As a last resort, you could use the full path to python:

#!/usr/local/bin/python3

I'm sure others will provide the correct method for getting BBEdit to recognize 
your scripts and finding the appropriate interpreter.

Maarten

-- 
-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at

If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Replace character in selection

2013-02-11 Thread Zephyr Mays
Thanks for the many suggestions!

Update and solution:  For my workflow, I have to copy numerous small bits 
of text (2-5 words) from one file and paste with transformations to 
another, so the best solution arose using the following (and attached) 
AppleScripts and keyboard shortcuts.

Regards,

Zephyr

*tell* *application* "BBEdit"

*set the clipboard to* (*change case* *of* (*the clipboard*) making lower 
case)

*set* theText *to* *the clipboard*

*set* AppleScript's text item delimiters *to* " "

*set* theTextItems *to* *text items* *of* theText

*set* AppleScript's text item delimiters *to* "_"

*set* theText *to* theTextItems *as* *string*

*set* AppleScript's text item delimiters *to* {""}

*set the clipboard to* theText

*paste*

*end* *tell*

*
*

*
*

*tell* *application* "BBEdit"

*set* theText *to* *the clipboard*

*set* AppleScript's text item delimiters *to* "_"

*set* theTextItems *to* *text items* *of* theText

*set* AppleScript's text item delimiters *to* " "

*set* theText *to* theTextItems *as* *string*

*set* AppleScript's text item delimiters *to* {""}

*set the clipboard to* theText

*set the clipboard to* (*change case* *of* (*the clipboard*) making capitalize 
words)

*paste*

*end* *tell*
*
*

-- 
-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at

If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




BBEdit & Python

2013-02-11 Thread Chip G.
I'm trying to learn Python. I have a book that is helping me along. I'd like to 
use BBEdit as my editor, but I'm having some issues. Part of this is an 
Apple/Fink thing. Part of the problem is that the version of python get if I 
run using 'python' is old (v2.7.1). If I force paths I can get v2.7.3 or 
v3.2.3. As near as I can tell, BBEdit uses the version as if I typed 'python' 
which doesn't work properly with the code in the book. Even if I download the 
authors copy directly. So I'm trying to find a way to force BBEdit to use a 
specific version 2.7.3 or 3.2.3 vice the 2.7.1 it keeps preferring. Any ideas?


--
Chip

-- 
-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at

If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: BBEdit and Dreamweaver battle

2013-02-11 Thread Bucky Junior
I don't use Dreamweaver but this has been a recent topic which I believe 
contains some answers to your questions. A quick search turns up a number of 
references.

Try this 


Bucky

On Feb 10, 2013, at 3:07 PM, C Fiddler  wrote:

> Dreamweaver and bbedit conflict:
> 
> How do I resolve a seamless integration or a loving cohabitation between 
> bbedit and dreamweaver right not they are at odds. I keep getting this 
> message in DW that says "Dreamweaver has detected a version of BBEdit that is 
> not Dreamweaver enabled. Please disable or upgrade BBEdit integration in 
> Dreamweaver general preferences" Well I reluctantly disabled BBEdit but I 
> need it to work in Dreamweaver though. Is there an issue with the last 
> upgrade of BBEdit with Dreamweaver. My OS is OSX 10.8.2
> 
> Looking for a cure! any suggestion?
> 

-- 
-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at

If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




BBEdit and Dreamweaver battle

2013-02-11 Thread C Fiddler
Dreamweaver and bbedit conflict:

How do I resolve a seamless integration or a loving cohabitation between bbedit 
and dreamweaver right not they are at odds. I keep getting this message in DW 
that says "Dreamweaver has detected a version of BBEdit that is not Dreamweaver 
enabled. Please disable or upgrade BBEdit integration in Dreamweaver general 
preferences" Well I reluctantly disabled BBEdit but I need it to work in 
Dreamweaver though. Is there an issue with the last upgrade of BBEdit with 
Dreamweaver. My OS is OSX 10.8.2

Looking for a cure! any suggestion?

-- 
-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at

If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 

--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.