We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,650 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Getting output from AS function from within Python

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?

2
Contributors
2
Replies
1 Week
Discussion Span
1 Year Ago
Last Updated
3
Views
FALL3N
Junior Poster in Training
89 posts since May 2010
Reputation Points: 10
Solved Threads: 2
Skill Endorsements: 0
Gribouillis
Posting Maven
Moderator
3,101 posts since Jul 2008
Reputation Points: 1,130
Solved Threads: 761
Skill Endorsements: 11

yup, thanks a lot!

FALL3N
Junior Poster in Training
89 posts since May 2010
Reputation Points: 10
Solved Threads: 2
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page generated in 0.0938 seconds using 2.68MB