Re: Help: Trouble with imp.load_module

Discussion in 'Python' started by Gabriel Genellina, Dec 17, 2007.

  1. En Tue, 11 Dec 2007 16:09:22 -0300, David Hirschfield <>
    escribi�:

    > So this must have something to do with the "." in the name of module
    > "test.B.py" but what is the problem, exactly? And how do I solve it? I
    > will sometimes need to run load_module on filenames which happen to have
    > "." in the name somewhere other than the ".py" extension. Is the
    > find_module somehow thinking this is a package?


    Module names must be identifiers (see section 6.12 in the Python Reference
    Manual) so test.B *cannot* be a module name. Just avoid such names as
    module names; if you know where the file is located, call load_module
    directly with an already open file and a fake module name.

    --
    Gabriel Genellina
    Gabriel Genellina, Dec 17, 2007
    #1
    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. David Hirschfield

    Help: Trouble with imp.load_module

    David Hirschfield, Dec 11, 2007, in forum: Python
    Replies:
    0
    Views:
    269
    David Hirschfield
    Dec 11, 2007
  2. Paul Sijben
    Replies:
    1
    Views:
    374
    Christian Heimes
    Feb 1, 2008
  3. Replies:
    2
    Views:
    1,033
  4. MRAB
    Replies:
    0
    Views:
    403
  5. Iuri
    Replies:
    0
    Views:
    155
Loading...

Share This Page