[IPython-dev] bug report: dreload not working with 'from module import'
Ralf Schmitt
ralf at brainbot.com
Wed Sep 24 07:05:14 EDT 2003
Fernando Perez wrote:
> Sorry for the late reply, I was on vacation.
>
> Ralf Schmitt wrote:
>
>> Hi,
>> sorry for posting to the developers mailing list, but using the
>> bugtracker wasn't possible (there seems to be no dns entry for
>> www.scipy.net).
>
>
> Mmh, works for me now. But this list is ok too, don't worry.
>
>> Starting IPython, importing ipbug.version, and trying to dreload it,
>> fails with 'ImportError: No module named ipbug.Version'.
>> I also wasn't able to checkout the cvs version ('Unknown host
>> scipy.org.' after I entered the password), so I have only included a
>> traceback for 0.5.0.
>
>
> Weird. I'm having no problem accessing the scipy.org cvs. Please let
> me know if this problem persists.
cvs access did work without any problems this morning..
>
> On to your bug: indeed, the dreload() code is far from perfect.
> Unfortunately, it's also extremely tricky, it has zero comments, and I
> didn't originally write it (it was one of the pieces from Nathan Gray
> I picked up when I started ipython). I'll put your report on the todo
> list, but this one may take a bit to get fixed. Every time I've had
> to deal with that code I've ended up with a headache :) But I promise
> to look into it.
When using deep_reload.py from IPython 0.4.0 and an otherwise unchanged
cvs version, the above dreload seems to work..diff's between those 2
files aren't that big :)
On to another bug:
Python 2.3 (#1, Sep 1 2003, 16:57:54)
Type "copyright", "credits" or "license" for more information.
IPython 0.5.1.cvs -- An enhanced Interactive Python.
? -> Introduction to IPython's features.
@magic -> Information about IPython's 'magic' @ functions.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
In [1]: import sys
In [2]: sys.modules
[......]
/usr/home/ralf/excvs/ipython/scripts/IPython/FakeModule.py in
__getattr__(self,
key)
23
24 def __getattr__(self,key):
---> 25 return self.__dict__[key]
26
27 def __str__(self):
KeyError: '__repr__'
Out[2]:
In [3]:
Seems like FakeModule is missing a __repr__ method. Here's a 2 line diff:
Index: FakeModule.py
===================================================================
RCS file: /home/cvsroot/world/ipython/IPython/FakeModule.py,v
retrieving revision 1.3
diff -u -r1.3 FakeModule.py
--- FakeModule.py 22 Aug 2003 16:04:33 -0000 1.3
+++ FakeModule.py 24 Sep 2003 10:49:15 -0000
@@ -27,3 +27,5 @@
def __str__(self):
return "<IPython.FakeModule instance>"
+ def __repr__(self):
+ return str(self)
More information about the IPython-dev
mailing list