Keychain Script on Leopard doesn't run on Tiger

Here’s a crucial Keychain Scripting script that compiles and runs fine on Leopard but generates an error when moved to Tiger without recompiling. If you recompile it on Tiger then it works again!


set thekey to "some_existing_generic_key_name"
-- obviously you have to change thekey variable to an existing generic key on login.keychain
tell application "Keychain Scripting"
	tell keychain "login.keychain"
		set thekey to some generic key whose name = thekey
	end tell
end tell

At first I thought it was an XCode (2.5) problem, but the same thing happens with script editor. I did find that compiling the AS Studio project in XCode 2.5 on Tiger and then running it on Leopard worked as expected. But I’m trying to stay in a Leopard development environment and this is not fun.

Is there any conceivable work-around to this problem?

Model: G5 Dual
Browser: Safari 523.10
Operating System: Mac OS X (10.5)

FWIW, this is the AEPrint for the script compiled in Leopard:


'obj '{ 
	'form':'indx', 
	'want':'cgen', 
	'seld':'abso'($20796E61$), 
	'from':'obj '{ 
		'form':'test', 
		'want':'cgen', 
		'from':'obj '{ 
			'form':'name', 
			'want':'ckc ', 
			'seld':'utxt'($6C006F00670069006E002E006B006500790063006800610069006E00$), 
			'from':'psn '($0000000001006800$) 
		}, 
		'seld':'cmpd'{ 
			'relo':'=   ', 
			'obj1':'obj '{ 
				'form':'prop', 
				'want':'prop', 
				'seld':'pnam', 
				'from':'exmn'($$) 
			}, 
			'obj2':'utxt'($720065006D006F007400650070007700$) 
		} 
	} 
}


And here it is compiled in Tiger:


'obj '{ 
	'form':'indx', 
	'want':'cgen', 
	'seld':11, 
	'from':'obj '{ 
		'form':'name', 
		'want':'ckc ', 
		'seld':"login.keychain", 
		'from':'psn '($0000000001006800$) 
	} 
}

I guess it might be significant that the Leopard Mac is PPC and Tiger is Intel. However I had this same problem when Leopard/Tiger was the same PPC G5 Mac and switching boot partitions.