gabrielfalcao/lettuce — Issue #203: ValueError: Attempted relative import in non-package
Author: lambdalisue
Created: 2011-12-07 15:27:08+00:00
State: open

When I use relative import in ``XXX-steps.py`` located in ``features`` directory, the ValueError occur at line 42 of https://github.com/gabrielfalcao/lettuce/blob/master/lettuce/fs.py

The way to fix it is a little bit complicated. Adding ``features`` directory path to ``sys.path`` and import with ``__import__('zzz')`` (current strategy you take) doesn't allow me to use relative import. What all you need to do is that you have to add project root directory path to ``sys.path `` and use ``__import__('xxx.yyy.features.zzz')`` to make it work.

Relative import is really useful when I create standalone (re-usable) application of Django. Otherwise I have to rewrite the tests again every time when I want to use previously created standalone application in different Django project :-(

This is a critical issue for me and I think is for everyone who create re-usable application not only for Django, so could you fix this issue? If I could fix it with myself but the issue is in main strategy of lettuce so it is too complicated for me to handle it.

Thanks for reading.