Import removing first module component

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • koblas

    Import removing first module component

    Have the following line:
    import notewave.runner .LMTP

    Yeilding the following error:
    ImportError: No module named runner.LMTP

    For the life of me I don't understand why the first component
    "notewave" is being stripped off, when the import is happening.

    Thanks,
  • David C. Ullrich

    #2
    Re: Import removing first module component

    In article
    <75481b47-87ec-4a84-8063-7abbdb286d62@u6 g2000prc.google groups.com>,
    koblas <koblas@gmail.c omwrote:
    Have the following line:
    import notewave.runner .LMTP
    >
    Yeilding the following error:
    ImportError: No module named runner.LMTP
    >
    For the life of me I don't understand why the first component
    "notewave" is being stripped off, when the import is happening.
    Does notewave contain a _module_ named runner.LMTP ?
    Probably not, since the error message says there's no
    such module.
    Thanks,
    --
    David C. Ullrich

    Comment

    • koblas

      #3
      Re: Import removing first module component

      On Jun 4, 2:48 pm, "David C. Ullrich" <dullr...@spryn et.comwrote:
      In article
      <75481b47-87ec-4a84-8063-7abbdb286...@u6 g2000prc.google groups.com>,
      >
       koblas <kob...@gmail.c omwrote:
      Have the following line:
              import notewave.runner .LMTP
      >
      Yeilding the following error:
              ImportError: No module named runner.LMTP
      >
      For the life of me I don't understand why the first component
      "notewave" is being stripped off, when the import is happening.
      >
      Does notewave contain a _module_ named runner.LMTP ?
      Probably not, since the error message says there's no
      such module.
      >
      Thanks,
      >
      --
      David C. Ullrich
      The following exist:
      .../notewave/runner/LMTP.py
      inside of LMTP.py there is:
      class LMTPRunner(Runn er) :

      Another person pointed out that I should check on the __init__.py and
      make sure lmtp is defined in the __all__ block. I didn't have an
      __init__.py at that level of the tree, which must have been causing
      problems, but clearly I don't understand the full inheritance of
      __init__.py and sub-directories.

      Comment

      • alex23

        #4
        Re: Import removing first module component

        On Jun 6, 1:44 am, koblas <kob...@gmail.c omwrote:
        Another person pointed out that I should check on the __init__.py and
        make sure lmtp is defined in the __all__ block. I didn't have an
        __init__.py at that level of the tree, which must have been causing
        problems, but clearly I don't understand the full inheritance of
        __init__.py and sub-directories.
        Heya,

        If you're not sure about packages, it's covered in the python docs
        here:



        An __all__ variable doesn't have to be defined, the __init__.py can be
        empty, as it's the presence of that file that informs python that the
        folder is a package. The example in the docs should help you here.

        Comment

        Working...