Noddy with submodules?

Discussion in 'Python' started by Torsten Mohr, Sep 7, 2009.

  1. Torsten Mohr

    Torsten Mohr Guest

    Hi,

    i want to write a Python module that interfaces a DLL that we use in the
    office to do some measurement.

    So i'd like to write a python module in C (which i did before some times).

    But i'm not sure how i can create a module in a way that i can later do:

    import measurement
    import measurement.adc
    import measurement.adc.channels
    import measurement.pwm

    What do i need to do to create submodules within the initialisation code
    of a python module written in C?

    Maybe there is an example based on "noddy"?


    Thanks for any hints,
    Torsten.
    Torsten Mohr, Sep 7, 2009
    #1
    1. Advertising

  2. En Mon, 07 Sep 2009 18:55:11 -0300, Torsten Mohr <>
    escribió:

    > So i'd like to write a python module in C (which i did before some
    > times).
    >
    > But i'm not sure how i can create a module in a way that i can later do:
    >
    > import measurement
    > import measurement.adc
    > import measurement.adc.channels
    > import measurement.pwm
    >
    > What do i need to do to create submodules within the initialisation code
    > of a python module written in C?


    I think it's easier to write a wrapper module in Python. See the xml.etree
    package; the cElementTree.py Python module just contains "from
    _elementtree import *" (_elementtree being a C extension)

    --
    Gabriel Genellina
    Gabriel Genellina, Sep 8, 2009
    #2
    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. GlennH
    Replies:
    1
    Views:
    1,122
    Mike Treseler
    Jul 11, 2003
  2. Torsten Mohr
    Replies:
    3
    Views:
    694
    Bernd Nawothnig
    Jun 2, 2004
  3. TG

    access to submodules

    TG, Jul 19, 2006, in forum: Python
    Replies:
    10
    Views:
    563
  4. Frank Aune

    Python submodules and name imports

    Frank Aune, Aug 23, 2007, in forum: Python
    Replies:
    1
    Views:
    805
    =?iso-8859-1?B?UOFkcmFpZw==?=
    Aug 23, 2007
  5. Donn Ingle
    Replies:
    7
    Views:
    266
    Gabriel Genellina
    Dec 19, 2007
Loading...

Share This Page