ImportError with packages

Discussion in 'Python' started by mr19, Nov 3, 2005.

  1. mr19

    mr19 Guest

    I'm running into import problems trying to create a
    package that is similiar in layout to the one in the
    docs described here:

    http://www.boost.org/libs/python/do...thon/techniques.html#python.creating_packages

    So my package layout is as follows:

    xyzzy/
    __init__.py
    research/
    __init__.py
    _research.so
    stats.pyc

    My __init__.py file contains 2 lines:

    from stats import *
    from _research import *

    With the directory containing 'xyzzy' on my
    PYTHONPATH, the following occurs:

    Python 2.4.2 (#2, Nov 3 2005, 11:35:03)
    [GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-52)] on linux2
    Type "help", "copyright", "credits" or "license" for more
    information.
    >>> import xyzzy.research

    Traceback (most recent call last):
    File "<stdin>", line 1, in ?
    File "xyzzy/research/__init__.py", line 2, in ?
    from _research import *
    ImportError: No module named _research

    Running python with the -vv switch shows python does
    indeed look at _research.so but does not load it.

    However if I put the directory containing _research.so
    on my PYTHONPATH the following command is successful:

    >>> import _research


    Thanks for any help you can offer,

    Marc
     
    mr19, Nov 3, 2005
    #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. Paul  Smith
    Replies:
    0
    Views:
    735
    Paul Smith
    Nov 18, 2003
  2. Tero Pihlajakoski

    JNI, Python ImportError

    Tero Pihlajakoski, Feb 10, 2004, in forum: Java
    Replies:
    2
    Views:
    749
    Tero Pihlajakoski
    Feb 11, 2004
  3. David Lyon
    Replies:
    19
    Views:
    589
    David Lyon
    Apr 24, 2009
  4. Ian
    Replies:
    3
    Views:
    174
  5. Jason Friedman
    Replies:
    0
    Views:
    148
    Jason Friedman
    Dec 27, 2012
Loading...

Share This Page