Archive for December 4th, 2009

“Adobe Unit Types.osax” & debugging Python on Mac

December 4, 2009

On OSX, if you’ve installed one of the Adobe apps, then when you debug your Python application you’ll start getting this annoying set of errors on the console:

osascript[13514:607] Error loading /Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types:  dlopen(/Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types, 262): no suitable image found.  Did find:
	/Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types: no matching architecture in universal wrapper
osascript: OpenScripting.framework - scripting addition "/Library/ScriptingAdditions/Adobe Unit Types.osax" declares no loadable handlers.

Here is how you get finally get rid of this problem. Delete this file alone wont fix the problem since launching another Adobe app will more than likely recreate this file. I found this solution to work:

cd /Library/ScriptingAdditions
sudo ln -s /dev/null ./Adobe\ Unit\ Types.osax

AuthKit, valid_password and wraptools

December 4, 2009

I’m new to AuthKit, and I wanted to override the method authkit.authenticate.valid_password for the form way of handling authentication. But could not figure out a good way of doing this. It appears that they only way overriding this method is to use the forward handler, but then again I had AuthKit working more or less the way I wanted using the form handler.

So how do you go about overriding one method in a library that you’re using? Well in Python you can use the wraptools module. This allows you to override a method using decorators. For example,

@replaces(authkit.authenticate.valid_password)
def valid_password(environ, username, password):
    try:
        # validate the username/password
        return True
    except YourLoginException:
        return False


Follow

Get every new post delivered to your Inbox.