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
Using warnings.warn() results in TypeError #2429
Milestone
Comments
Hadn't seen that one thanks. Your solution works great for me. |
Great, I'll close this issue as a duplicate. |
Carreau
added a commit
that referenced
this issue
Sep 30, 2012
Revert #1831, the `__file__` injection in safe_execfile / safe_execfile_ipy. This reverts commit 2717feb, reversing changes made to ea4f608. Pull request #1831 (fix #1814 set __file__ when running .ipy files) has been the source of a lot of grief: #2279: Setting __file__ to None breaks Mayavi import #2429: Using warnings.warn() results in TypeError In general the patch was inappropriate because it: 1. Fails to properly restore the context, by setting __file__ to None rather than deleting it. 2. Sets __file__ in the wrong dictionary (self.user_ns rather than where[0]).
mattvonrocketstein
pushed a commit
to mattvonrocketstein/ipython
that referenced
this issue
Nov 3, 2014
Revert ipython#1831, the `__file__` injection in safe_execfile / safe_execfile_ipy. This reverts commit 2717feb, reversing changes made to ea4f608. Pull request ipython#1831 (fix ipython#1814 set __file__ when running .ipy files) has been the source of a lot of grief: ipython#2279: Setting __file__ to None breaks Mayavi import ipython#2429: Using warnings.warn() results in TypeError In general the patch was inappropriate because it: 1. Fails to properly restore the context, by setting __file__ to None rather than deleting it. 2. Sets __file__ in the wrong dictionary (self.user_ns rather than where[0]).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The following code when run in the ipython terminal, qtconsole, and notebook will incorrectly produce a TypeError:
Specifically, running it gives the following trace:
Based on a git bisect, it cropped in with commit 2140420. Specifically, the offending line is 2459 (on master):
If I change
None
to''
, the error goes away and I see the warning. This is important, because it was resulting in tracebacks when numpy would issue a warning. I'm not sure if''
is the proper fix, so I haven't created a PR.The text was updated successfully, but these errors were encountered: