-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Relative imports issue #18
Comments
Hi John, I generally prefer absolute imports but unfortunately they are not safe. I'm sure we can work with relative imports, because we are using them a Thanks Am 05/05/15 um 03:49 schrieb John Chodera:
Prof. Dr. Frank Noe Phone: (+49) (0)30 838 75354 Mail: Arnimallee 6, 14195 Berlin, Germany |
I can not reproduce this:
does not raise the described ImportError |
fixed by #20 |
This works fine for tools like If you want to use parts of |
I am using exclusively lazy imports to pyemma in bhmm. Am 05/05/15 um 19:48 schrieb John Chodera:
Prof. Dr. Frank Noe Phone: (+49) (0)30 838 75354 Mail: Arnimallee 6, 14195 Berlin, Germany |
So there shouldn't be any issues if we convert to absolute import paths, should there? |
No that should be fine. I now get your point, although I don't Am 05/05/15 um 19:55 schrieb John Chodera:
Prof. Dr. Frank Noe Phone: (+49) (0)30 838 75354 Mail: Arnimallee 6, 14195 Berlin, Germany |
Sounds great, thanks! |
I can't get the latest version to actually run any tests at all.
I think the issue has to do with relative imports. Instead of
from bhmm import ...
, everything uses relative pathnames inside of thebhmm
package---especiallyapi.py
, e.g.:https://github.com/bhmm/bhmm/blob/master/bhmm/api.py#L5-L8
Are you testing this from within the
bhmm
github repo, rather than outside of the repo? If so, your python interpreter would be handling relative imports OK, but the installed version would not work if you were in a different directory (like one of the examples directories).The error I get when running nosetests from a directory that is not the github repo is:
There is more info on relative imports in Python here, though I'm afraid relative imports are still quite confusing to me. Absolute imports seem relatively safe.
The text was updated successfully, but these errors were encountered: