globals in modules and inheritance from a C object

Lloyd NOSPAM at fusion.net.nz
Mon Jan 6 04:21:28 EST 2003


Hey

1. I've embedded python in a simple application. I've created a custom
object and I've added it to the global dictionary with the name "capi". I
then load a python module with PyImport_ImportModuleEx passing my global
dictionary in as the globals parameter. The module loads correctly.

I then try instance an object from the module and I get this error:

global name 'capi' is not defined.

How do I get the module to check the global namespace for capi? It loaded it
ok with my passing globals as an optional parameter?

The reason I need an instance of the object is that I need the SELF pointer
passed through from python.

2. Is it possible to inherit from a module. I want to directly inherit from
one of my C custom objects. The only way I can see to do this currently is
to create a python proxy object that contains a C object and the overload
the get/set attr methods so that it correctly sends the requests to the C
object? Is there a better way around this? It seems a bit of a waste...

Thanks again
Lloyd







More information about the Python-list mailing list