Start New Discussion within our Software Development Community
import os;

def callAS(cmd):
	os.system(cmd);

def selectFile():
	 callAS("""osascript -e 'tell application "Finder" to return choose file "Select the file:"'""")

def fixPath(raw):
	arr = raw.split(' ');
	return(str(arr[1]));

thePath = selectFile()
thePath = fixPath(thePath);
print(thePath);

When the above code is run in IDLE, it just gives an error. But, when the above code is run in BBedit, it returns an error (saying that I can't split an object of null type), but also outputs alias First:Applications:Adapter.app: ... How do I get the output from an AS function run from within Python?

This article has been dead for over six months. Start a new discussion instead.