Embedding: Defining packages?

Michael P. Reilly arcege at shore.net
Mon Jul 19 20:21:21 EDT 1999


Bjoern Giesler <un4e at rz.uni-karlsruhe.de> wrote:
: Hi,

: I'm embedding Python in a rather complex C program. To represent the
: complexity (and to keep the thing modular), I want to define several 
: Python modules and group them in a package hierarchy:

:          MyProgram
:          +- Server
:          |       +- Communications
:          |       +- HardwareAccess
:          +- Client
:                  +- Communications
:                  +- AbstractObjects

: ...etc. How do I do that? Is there a way to pass hierarchical module names
: to Py_InitModule, such as

: theModule = Py_InitModule(methodDefs, "MyProgram.Server.Communications");

: My attempts so far haven't worked.

: Thanks in advance,
:          --Bjoern

: PS I'm posting this via the newsgroup, as sending mail to python-list at cwi.nl
:    doesn't seem to work. Has anything changed there that I'm not aware of?

You probably need to reverse the order of the arguments
  (http://www.python.org/doc/current/ext/methodTable.html)

theModule = Py_InitModule("MyProgram.Server.Communications", methodDefs);

(I've tried this format successfully.)

  -Arcege





More information about the Python-list mailing list