Clearing a session and reload() problem (with repro error)

Rafe rafesacks at gmail.com
Tue Sep 9 23:56:43 EDT 2008


On Sep 9, 11:03 pm, "Gabriel Genellina" <gagsl-... at yahoo.com.ar>
wrote:
> En Mon, 08 Sep 2008 05:37:24 -0300,Rafe<rafesa... at gmail.com> escribió:
> ...
> This dependency between modules, applied to all modules in your project,
> defines a "dependency graph". In some cases, one can define a partial
> ordering of its nodes, such that no module depends on any other module
> *after* it (it may depend only on modules *before* it). Look for
> "topological sort".
>
> Doing that in the generic case is not easy. If you *know* your
> dependencies, reload the modules in the right order by hand.
> ...
> --
> Gabriel Genellina

Hi Gabriel,

Thank you for clarifying and re-presenting parts of my case. I
appreciate the time.

I was hoping there would be a way to just wipe out the module cache
and let it get rebuilt by executing my code (since I'm not using
reload as part of my program, but rather, to test it in an environment
where I cannot restart the Python session).

I have been keeping a diagram of my module inheritance to make sure it
is as clean as possible, so I could just right a list of reloads as
you suggest. However, one of the sub-packages is designed to allow
users to add more modules. Because these get dynamically imported, a
guess I could add an argument to the reload function to allow a user
to give the 'add-on' module they are working on... so much work just
to get a clean environment...

Separate of my program, I was really hoping to write a generic reload
tool for anyone developing in the same application as I am. I just
don't see a way to trace import dependencies in systems which include
dynamic imports. Any ideas?


Thanks again,

- Rafe



More information about the Python-list mailing list