Women in Technology

Hear us Roar



Article:
  Using Python and AppleScript Together
Subject:   A generic problem with this
Date:   2007-05-10 09:29:03
From:   jimschimpf
I've read a number of articles about using Applescript with various languages, your article and articles using Ruby but none of these ever work on my box (1Ghz 12" Powerbook with 10.4.9). There is something wrong with osascript on my box, if I attempt something simple like


osascript -e "tell app TextEdit to quit"


I get:


2007-05-10 12:19:44.573 osascript[26045] CFLog (21): Error loading /System/Library/Components/AppleScript.component/Contents/MacOS/AppleScript: error code 4, error number 0 (Symbol not found: __cg_png_destroy_write_struct
Referenced from: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO
Expected in: /usr/local/lib/libPng.dylib
)
osascript: can't open default scripting component.


What have I broken and how could I fix this ?


--jim

Full Threads Oldest First

Showing messages 1 through 3 of 3.

  • A generic problem with this
    2007-05-11 18:41:43  BareFeet [View]

    You need to instead write:

    osascript -e 'tell app "TextEdit" to quit'
    • Noah Gift photo A generic problem with this
      2007-05-12 15:27:11  Noah Gift | O'Reilly AuthorO'Reilly Blogger [View]

      That is the correct way to escape from the command line. Good comment. Your way might be a little less confusing for people than my way as well.

      Of course the poster above has two problems which is the worst kind. A bad installation possibly, plus, the wrong quoting(syntax).

  • Noah Gift photo A generic problem with this
    2007-05-10 09:55:02  Noah Gift | O'Reilly AuthorO'Reilly Blogger [View]

    Sometimes things like this can be a real pain to debug. I have gotten so used to reimaging my machine that if it takes more than 10 minutes...I use the asr tool to reimage my Operating System from an image I keep on a second partition.

    I have my User's folder symbolically linked to the second hard drive so I can easily erase my main partition by booting into the second partition.

    I have some example code that is more geared toward doing this from a netboot image, but you could implement this on a second partition:

    http://smartosxdeploy.googlecode.com/svn/trunk/nuke.py