Reference implementation of an import hook

Discussion in 'Python' started by Noam Raphael, Jun 21, 2004.

  1. Noam Raphael

    Noam Raphael Guest

    Hello,

    Do you know of a reference implementation of an import hook? I mean a
    class, written in Python, that imitates Python's default module loading
    behaviour. I mean that I would be able to append the class to
    sys.path_hooks, and modules will be imported in the same way they are
    currently imported.

    I want it so that it would be easy for me to change it, or subclass it,
    for my own needs, while preserving its behaviour. (The situation, if you
    are interested, is that currently modules are loaded from the network,
    which takes a long time, and I want to create a caching mechanism which
    will use the local hard-disk.)

    Thank you,
    Noam Raphael
     
    Noam Raphael, Jun 21, 2004
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Torsten Mohr

    import hook, overwrite import?

    Torsten Mohr, Jan 26, 2005, in forum: Python
    Replies:
    2
    Views:
    579
    Steve Holden
    Jan 27, 2005
  2. Jeremy Sanders

    import hook

    Jeremy Sanders, Jun 11, 2006, in forum: Python
    Replies:
    4
    Views:
    468
    Jeremy Sanders
    Jun 18, 2006
  3. Michael Tsang
    Replies:
    32
    Views:
    1,565
    Richard Bos
    Mar 1, 2010
  4. Michael Tsang
    Replies:
    54
    Views:
    1,631
    Phil Carmody
    Mar 30, 2010
  5. Declare schema import in C# implementation

    , May 10, 2004, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    210
    Dino Chiesa [Microsoft]
    May 13, 2004
  6. sanket
    Replies:
    7
    Views:
    1,457
    Tsung
    Nov 3, 2011
  7. Andrea Crotti

    simple import hook

    Andrea Crotti, Nov 10, 2011, in forum: Python
    Replies:
    0
    Views:
    208
    Andrea Crotti
    Nov 10, 2011
  8. Andrea Crotti
    Replies:
    0
    Views:
    237
    Andrea Crotti
    Jan 19, 2012
Loading...