Skip to content
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 broken in the notebook (Windows) #4317

Closed
rossant opened this issue Sep 30, 2013 · 5 comments · Fixed by #4318
Closed

Relative imports broken in the notebook (Windows) #4317

rossant opened this issue Sep 30, 2013 · 5 comments · Fixed by #4318
Milestone

Comments

@rossant
Copy link
Contributor

rossant commented Sep 30, 2013

It seems like relative imports do not work anymore in my notebooks since 6590fa5.
I'm on Windows 8 64 bits, Python 2.7.5.

@takluyver
Copy link
Member

Odd, I can't see how that would have affected import machinery. Can you give an example of a failing case?

@rossant
Copy link
Contributor Author

rossant commented Sep 30, 2013

Weird. It only happens on my default profile, not in a fresh profile (I have a few startup scripts). Let me investigate further...

@rossant
Copy link
Contributor Author

rossant commented Sep 30, 2013

Very weird. No startup script = no problem. Add an empty .py file in .ipython/profile_default/startup, and relative imports do not work anymore!

Test notebook:

# <codecell>
%%writefile mymodule.py
a = 1

# <codecell>
import mymodule

@takluyver
Copy link
Member

Hmm, I see that as well. Weird.

It's not actually a relative import, though - it's an absolute import, it's just that the CWD isn't getting added to sys.path, for some reason.

@takluyver
Copy link
Member

OK, after some frenzied debugging with frequent cries of 'what?', Min has a fix on the way.

minrk added a commit to minrk/ipython that referenced this issue Sep 30, 2013
recent change caused initial sys.path to lose '' as the first element in the notebook.

closes ipython#4317
@minrk minrk added this to the 2.0 milestone Mar 26, 2014
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014
recent change caused initial sys.path to lose '' as the first element in the notebook.

closes ipython#4317
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants