run-time inclusion of files

Discussion in 'Python' started by travis+ml-python@subspacefield.org, Sep 5, 2009.

  1. Guest

    Hello,

    I was wondering if there was something like Perl's "require" that allows
    you to import a file whose name is specified at run-time. So far I've only
    seen imports of modules that are put in the standard module include path.

    I'm interested in three seperate problems:

    1) being able to import a file that isn't in the standard module include path

    2) being able to import a file whose name is specified in a python string

    3) being able to reload the file if it changes on disk

    I'm pretty sure that the Pylons web framework does all this, and I'm also
    pretty sure that there's a simple solution, I am just not aware of what
    it is.
    --
    Obama Nation | My emails do not have attachments; it's a digital signature
    that your mail program doesn't understand. | http://www.subspacefield.org/~travis/
    If you are a spammer, please email to get blacklisted.

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.9 (OpenBSD)

    iQIcBAEBAgAGBQJKouTHAAoJEGQVZZEDJt9H6ugP/jSMFjNqAGOqEjpiJppLtZKL
    3FLkeMOMohqq21CGyoGef1IgYMTl3eoRT1MrEKlG/Hbd6VY0JLKmQtbSrPvzpqLM
    YReSqNpAwY421grNRItv3nnLC+Bu0ZlYgYA/hyvYPPzy6AeRvwZc0fcw5eoF90GA
    ZctM58hHRFXTxaiA67VAP1/3O6vd0PlyYwKUsCffRwqiMKUgJtuLVctkd9t+JtPm
    BGhqPw/avC6YaMCddA4ufXEJhHUxlqKcI9nlBDnLGhPVdUNc6PtkmfwOMy26gq8l
    n5oI/juGTS3bJ+RHXddK1lj7lTuJRaS/uzJ3eEf/WJh2Y8PlBjUNyxcXvdTXjro4
    60jbDN9FAfeSIqbjFCsff5xq0MOIqMb/nL6Ih8VXU/lKoEoHAr3auyWImS80TnE5
    w57AMZEr5iOIpGwcde2ZPTNNAJm3mIN00KOPeEwz2U9R79xsT5u4z/gcI+FohS+m
    S/LQkdguPiR8AHi4x2skaIXt7gOXZXuseVBXq+AGuGJfHdzXLQEg6Jvwwzf2ec+G
    43NUnsHEqCI0BlK9pWQXcx3b5VhpcdDVHOv9CskShWOnx61Nr6xz13zPpaRCarp+
    xmwAUbHi8kjmLgytfz4/g04LK7VOAkU9+fDKUO1qwIoSDFo7uZ2dpYiAAHJWirdh
    a4Wqgf0NW38JcKLKdcFU
    =cwhK
    -----END PGP SIGNATURE-----
    , Sep 5, 2009
    #1
    1. Advertising

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. kpoan
    Replies:
    0
    Views:
    470
    kpoan
    Aug 15, 2006
  2. David T. Ashley

    Multiple Inclusion of Standard Header Files

    David T. Ashley, Jan 14, 2007, in forum: C Programming
    Replies:
    7
    Views:
    354
    Serve Laurijssen
    Jan 14, 2007
  3. Replies:
    9
    Views:
    308
    Joachim Schmitz
    Dec 7, 2007
  4. Pierre Yves
    Replies:
    2
    Views:
    468
    Pierre Yves
    Jan 10, 2008
  5. joy99
    Replies:
    6
    Views:
    737
    Terry Reedy
    Sep 14, 2009
Loading...

Share This Page