O'Reilly logo

Python: Essential Reference, Third Edition by David Beazley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Embedding

The Python interpreter can also be embedded into other applications. When embedding the interpreter on UNIX, you must include the file config.c (usually found in a place such as <python>/lib/python2.4/config/config.c, where <python> is the directory in which Python was installed) and link against the library libpython2.4.a. (A comparable but more complex process is required on Windows and the Macintosh. Consult the online documentation for details.)

The following functions are used to call the interpreter to execute code and control its operation:

						int PyRun_AnyFile(FILE
						*fp,
						char
						*filename)

If fp is an interactive device such as tty in Unix, this function calls PyRun_InteractiveLoop(). Otherwise, PyRun_SimpleFile() is called. filename ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required