Python doesn’t play nicely with others
leancrew.com
leancrew.com
This is not a new observation; it's why envoy exists (as the author acknowledges). If envoy proves successful it ought to make it into the standard library in the future. This is how progress happens.
But here? Really?
for f in $* ; do
(echo ${f/.txt//} ; cat $f) | pbcopy
osascript < the_copy_script
done
And let's move to doing some useful things instead. I'm not even sure why he picked on python in this case, since it's the notes application that has issues with interoperability (is it really the easiest way to interact with it? by simulating clicks?)"Today I want to talk about a script that appeared in a post on Mac OS X Hints a couple of days ago. What the script does isn’t of great interest to me, but the technique the programmer used to combine Python and AppleScript is."
I just get the feeling this was only considered "clumsy" because there is not enough other code to complain about anything else.
I think this needs expanding. I don't see anything wrong or too clumsy in the communicate method.
But overall I agree...i don't feel it's too clumsy.
use IPC::Cmd qw{run_forked};
my $applescript = q{display alert "Hello, world!"}
my $results = run_forked( 'osascript', {child_stdin => $applescript} );You can find a list of all of the modules distributed with Perl at http://perldoc.perl.org/perlmodlib.html#THE-PERL-MODULE-LIBR...
You can find links to their documentation beginning at http://perldoc.perl.org/index-modules-A.html
> I’ve written programs that used os.system or os.popen because, in earlier versions of Python, that was the recommended way to do it
just stick to using os.* - just because the documentation recommends you 'upgrade' doesn't mean it is right.