Home > Graphics > Updating your Twitter Avatar from Acorn

Updating your Twitter Avatar from Acorn

March 19th, 2008

If you are on Twitter, chances are that you have one avatar that you never update because there is nothing in Twitter’s API to access that part of your profile.

I have written a pair of script for Acorn that will allow you to do this.

 

Warning:I have tested this on Leopard 10.5.2, with ruby 1.8.6. It works for me. YMMV.

  1. Download the two scripts here, and put them in ~/Library/Application Support/Acorn/Plug-Ins/

    The archive contains a python script (which Acorn will load) and a helper ruby script to do the heavy lifting.

  2.  

  3. Important! Customize the Twitter.py script with your twitter username and password.

    Maybe I will update the script to have a real UI for this, or simply use the keychain. This is a quick-and-dirty hack.

  4.  

  5. Install the mechanize ruby gem, if you don’t already have it: 
    % sudo gem install mechanize
  6.  

  7. Launch Acorn. Open an image. Edit it (crop it, etc…). You should be able to send it to Twitter by selecting File->Actions->Save as Twitter Avatar (by default, Control-Command-T).

That’s it! Share and enjoy!

Categories: Graphics Tags:
  1. Patch
    March 20th, 2008 at 08:35 | #1

    Hey, great work on this! I was just wondering, though, why you chose both a Ruby and a Python approach rather than one or the other? You say the Ruby program is "for heavy lifting," but in fact, there’s a Python mechanize module that allows similar functionality. I’ve used it on a couple of datamining projects and it works well.

  2. March 20th, 2008 at 08:50 | #2

    Python out of necessity (it’s what Acorn uses) and ruby out of simplicity, since it allowed me to get it out the door yesterday.

    I will probably refactor the plugin to use python’s mechanize module, but I have to figure out how it works first…

  3. March 20th, 2008 at 10:20 | #3

    Any idea what this Terminal error when trying to install the Ruby gem means?

    ERROR: Error installing mechanize:
    ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb install mechanize
    can’t find header files for ruby.

    I’m on 10.5.2. Thanks.

  4. March 20th, 2008 at 16:39 | #4

    Many thanks for this! Saw the idea bounced on twitter and then it seemed in no time at all it was live!

    Used it to edit & upload a new picture for myself[1] in honour of redcoatteam[2]

    [1] http://twitter.com/caius
    [2] http://twitter.com/redcoatteam

  5. March 21st, 2008 at 16:27 | #5

    @David install the Mac OS X Developer Tools, then retry.

  6. March 26th, 2008 at 00:37 | #6

    Yep, didn’t realized the developer tools were needed for this. Thanks for the advice Nathan. Worked perfectly.

  7. Ram
    November 10th, 2008 at 00:48 | #7

    Looks like the Ruby script is broken?

    NoMethodError: undefined method `username_or_email=’ for #
    from /usr/lib/ruby/gems/1.8/gems/mechanize-0.8.4/lib/www/mechanize/form.rb:130:in `method_missing’
    from (irb):10

    Is there a good fix?

Comments are closed.