[IPython-user] Module reload in interactive mode

Ignazio Di Napoli neclepsio@gmail....
Tue Feb 10 15:43:52 CST 2009


> Perhaps you could check your ipython version and give a minimal
> example like the above of what doesn't work.

Version is last stable (0.9.1) under Windows.
The code to show it is:

*** prova/test.py:
from package import *
function()

*** prova/package/__init__.py
from module import *

*** prova/package/module.py
def function():
  if 1 == 2:
    return True
  raise Exception()


*** execution log:

[C:Desktop/prova]|2> run test.py
---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)

C:\Users\Ignazio\Desktop\prova\test.py in <module>()
      1 from package import *
      2
----> 3 function()
      4
      5

C:\Users\Ignazio\Desktop\prova\package\module.py in function()
      2     if 1 == 2:
      3         return True
----> 4     raise Exception()
      5
      6

Exception:
WARNING: Failure executing file: <test.py>
[C:Desktop/prova]|3> dreload(package)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)

C:\Users\Ignazio\Desktop\prova\test.py in <module>()
----> 1
      2
      3
      4
      5

NameError: name 'package' is not defined
[C:Desktop/prova]|4> dreload(module)

*** modified 1==2 in 1==1

Reloading package.module
                 <4> <module 'package.module' from 'C:\Users\Ignazio\Desktop\pro
va\package\module.py'>
[C:Desktop/prova]|5> run test.py
---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)

C:\Users\Ignazio\Desktop\prova\test.py in <module>()
      1 from package import *
      2
----> 3 function()
      4
      5

C:\Users\Ignazio\Desktop\prova\package\module.py in function()
      2     if 1 == 1:
      3         return True
----> 4     raise Exception()
      5
      6

Exception:
WARNING: Failure executing file: <test.py>



Thank you,
Ignazio


More information about the IPython-user mailing list