1.11M Members

Getting output from AS function from within Python

 
0
 
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?

 
0
 

yup, thanks a lot!

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: