Note that there are some explanatory texts on larger screens.

plurals
  1. POFailure to find module in split namespace
    primarykey
    data
    text
    <p>I am working with <code>Python 3.3.1</code> 64 bit on <code>Ubuntu 13.04</code> 64 bit running under <code>Eclipse 4.3</code> 64 bit with <code>Pydev 2.7.6</code> in a <code>virtualenv</code> environment. I have my project in the following directory structure.</p> <pre><code>Dictionary | ---------------------------- | | src test | | petaapan petaapan | | | | __init__.py logging __init__.py logging | | | | __init__.py mplogging.py __init__.py test_mplogging.py </code></pre> <p>When I try to run <code>test_mplogging.py</code> using <code>pytest</code> as the test runner I get the following results:</p> <pre><code>pydev debugger: starting ============================= test session starts ============================== platform linux -- Python 3.3.1 -- pytest-2.3.5 plugins: pep8, cache collected 0 items / 1 errors ==================================== ERRORS ==================================== ______________________ ERROR collecting test_mplogging.py ______________________ File "/home/jonathan/UC/Git Repositories/isiiwesuu/Dictionary/tests/petaapan/logging/test_mplogging.py", line 11 in &lt;module&gt; &gt; import petaapan.logging.mplogging as ml E ImportError: No module named 'petaapan.logging.mplogging' </code></pre> <p>My <code>sys.path</code> has <code>Dictionary/test</code> ahead of <code>Dictionary/src</code> so the test tree is searched first and it looks as though that is why the import failed with regular packages.</p> <p>My next attempt was to do the same using namespace packages, so I removed all the <code>__init__.py</code> files and got the following results:</p> <pre><code>pydev debugger: starting ============================= test session starts ============================== platform linux -- Python 3.3.1 -- pytest-2.3.5 plugins: pep8, cache collected 0 items / 1 errors ==================================== ERRORS ==================================== ______________________ ERROR collecting test_mplogging.py ______________________ File "/home/jonathan/UC/Git Repositories/isiiwesuu/Dictionary/tests/petaapan/logging/test_mplogging.py", line 11 in &lt;module&gt; &gt; import petaapan.logging.mplogging as ml File "/home/jonathan/UC/Git Repositories/isiiwesuu/Dictionary/tests/petaapan/logging/&lt;frozen importlib._bootstrap&gt;", line 1564 in _find_and_load &gt; ??? File "/home/jonathan/UC/Git Repositories/isiiwesuu/Dictionary/tests/petaapan/logging/&lt;frozen importlib._bootstrap&gt;", line 1522 in _find_and_load_unlocked &gt; ??? File "/home/jonathan/UC/Git Repositories/isiiwesuu/Dictionary/tests/petaapan/logging/&lt;frozen importlib._bootstrap&gt;", line 1476 in _find_module &gt; ??? File "/home/jonathan/isiiwesuu/lib/python3.3/site-packages/_pytest/assertion/rewrite.py", line 68 in find_module &gt; fd, fn, desc = imp.find_module(lastname, path) File "/home/jonathan/isiiwesuu/lib/python3.3/imp.py", line 197 in find_module &gt; "not {}".format(type(name))) E RuntimeError: 'list' must be None or a list, not &lt;class 'str'&gt; =========================== 1 error in 0.49 seconds ============================ </code></pre> <p>Here is <code>test_mplogging.py</code> relevant parts:</p> <pre><code>import logging from os import getcwd from multiprocessing import Queue, Process import petaapan.logging.mplogging as ml </code></pre> <p>Can anyone suggest what I need to do in this situation?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload