Embedded python: dotted (sub) module name

Discussion in 'Python' started by logistix at cathoderaymission.net, Jul 31, 2003.

  1. 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.
     
    logistix at cathoderaymission.net, Jul 31, 2003
    #1
    1. Advertising

  2. logistix at cathoderaymission.net

    Carl Banks Guest

    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
     
    Carl Banks, Jul 31, 2003
    #2
    1. Advertising

  3. Carl Banks <> wrote in message news:<xj%Va.2846$>...
    > 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.
     
    logistix at cathoderaymission.net, Jul 31, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jag
    Replies:
    2
    Views:
    8,402
    Randy Rahbar
    Nov 14, 2003
  2. Timo Nentwig
    Replies:
    0
    Views:
    293
    Timo Nentwig
    Oct 27, 2004
  3. xEM
    Replies:
    5
    Views:
    5,008
    Jukka K. Korpela
    Oct 4, 2003
  4. Ben
    Replies:
    2
    Views:
    898
  5. Lawrence D'Oliveiro

    Death To Sub-Sub-Sub-Directories!

    Lawrence D'Oliveiro, May 5, 2011, in forum: Java
    Replies:
    92
    Views:
    2,043
    Lawrence D'Oliveiro
    May 20, 2011
Loading...

Share This Page