Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Embedded python: dotted (sub) module name

Reply
Thread Tools

Embedded python: dotted (sub) module name

 
 
logistix at cathoderaymission.net
Guest
Posts: n/a
 
      07-31-2003
I get the feeling I'm just picking the wrong google search phrase
here, because I'm finding nothing. I'm trying to namespace out some
embedded python modules. This works:

Py_InitModule("game", py_game_methods);

but this doesn't:

Py_InitModule("quake.game", py_game_methods);

What am I missing here? Any help would be appreciated.
 
Reply With Quote
 
 
 
 
Carl Banks
Guest
Posts: n/a
 
      07-31-2003
logistix at cathoderaymission.net wrote:
> I get the feeling I'm just picking the wrong google search phrase
> here, because I'm finding nothing. I'm trying to namespace out some
> embedded python modules. This works:
>
> Py_InitModule("game", py_game_methods);
>
> but this doesn't:
>
> Py_InitModule("quake.game", py_game_methods);
>
> What am I missing here? Any help would be appreciated.



A module's package is defined the importer, not by the module itself.
Move a module file to a different directory, and BAM, it's in a
different package.

If your only wish is to make it so that someone can import your
extension module using "from quake import game", then it is enough to
just copy the DLL or shared lib into the proper directory. (Well, you
also have to remember to put an __init__.py file in the quake
directory.)


--
CARL BANKS
 
Reply With Quote
 
 
 
 
logistix at cathoderaymission.net
Guest
Posts: n/a
 
      07-31-2003
Carl Banks <(E-Mail Removed)> wrote in message news:<xj%Va.2846$(E-Mail Removed)>...
> logistix at cathoderaymission.net wrote:
> > I get the feeling I'm just picking the wrong google search phrase
> > here, because I'm finding nothing. I'm trying to namespace out some
> > embedded python modules. This works:
> >
> > Py_InitModule("game", py_game_methods);
> >
> > but this doesn't:
> >
> > Py_InitModule("quake.game", py_game_methods);
> >
> > What am I missing here? Any help would be appreciated.

>
>
> A module's package is defined the importer, not by the module itself.
> Move a module file to a different directory, and BAM, it's in a
> different package.
>
> If your only wish is to make it so that someone can import your
> extension module using "from quake import game", then it is enough to
> just copy the DLL or shared lib into the proper directory. (Well, you
> also have to remember to put an __init__.py file in the quake
> directory.)


Thanks, but I don't have a physical .pyd since this is an embedded
interpreter. I'm just calling my 'init_module()' function directly
from C, similar to the way array and other modules are statically
added to the python dll.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
EL: how to access dotted-named attributes? Timo Nentwig Java 0 10-27-2004 07:52 PM
"Dotted" appearing text flycaster1 Computer Support 7 10-13-2004 06:31 PM
[Q] Javascript to remove dotted rectangles in IE Paul Sellis HTML 9 02-24-2004 10:36 AM
how to get dotted underline on web page Jag ASP .Net 2 11-14-2003 03:34 PM
border-style: dotted in IE xEM HTML 5 10-04-2003 10:37 AM



Advertisments