1

Is it possible for an objective c application to run python files and read their data, etc?

If so, can someone post code? or lead me in the right direction?

Thanks, Elijah

1 Answer 1

1

Sure, see the tutorial -- it's very dated but should still apply today. (Apple's tutorial is good, but it only shows how to call ObjC from Python, while pyobjc's own tutorial, while extremely short, focuses on the opposite direction -- calling Python from ObjC -- which appears to be what you want).

Sign up to request clarification or add additional context in comments.

3 Comments

Now, if I wanted to control HOWIE (pyaiml chat bot howie.sourceforge.net) with objective c, how would I do that? I want to make a GUI for HOWIE. BUT, I don't want to use terminal as an interface, I want the GUI to be the interface to get HOWIE's responses and send input.
I don't know howie (nor does it interest me enough to study it;-) but at worst you can control it with pyexpect and write the whole Mac GUI with Xcode, Cocoa, and Python (with PyObjC -- see Apple's tutorial I already pointed to) -- absolutely no need to "run Python code" from "an objective C application";-). Or, instead of pyexpect, you can look inside howie and use or make a decent Python API for it -- but, again, what does that have to do with objective-c?!
@Elijah, yep, I'm pretty experienced in Python, but what little free time I have I spend responding on Stack Overflow (where my answers can hopefully be read and used by many people), not on 1-on-1 help which just doesn't scale -- sorry. If you don't know either Python or Tcl, I don't know how to "drive" a text-mode app you can't change (because you don't know its language, whatever it may be) from a GUI front-end -- expect is Tcl, pyexpect is Python (I don't know of any equivalent for ObjC). However, Python is easy to learn!-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.