problem with packages and path

Marco Bizzarri marco.bizzarri at gmail.com
Thu Aug 28 04:28:06 EDT 2008


On Wed, Aug 27, 2008 at 6:44 PM, Daniel <daniel.watrous at gmail.com> wrote:
> Hello,
>
> I'm writing some unit tests for my python software which uses
> packages.  Here is the basic structure:
>
> mypackage
>  __init__.py
>  module1
>    __init__.py
>    mod1.py
>  module2
>    __init__.py
>    mod2.py
>  unittests
>    __init__.py
>    alltests.py
>    test1.py
>    test2.py
>
> within alltests.py I would expect to be able to "import
> mypackage.unittests.test1".  In fact within PyScripter this works as
> expected.  However, when I execute the code from the command line, I
> get the following error:
>
> ImportError: No module named mypackage.unittests.test1
>

1) What is the command you're using to run the alltest.py module?

2) what is the result of:
   - python -c "import mypackage"
  - python -c "import mypackage.unittests"

Regards
Marco



-- 
Marco Bizzarri
http://iliveinpisa.blogspot.com/



More information about the Python-list mailing list