Results 1 to 3 of 3

Thread: Python and Dynamic Imports

  1. #1

    Python and Dynamic Imports

    I'm wanting to import a specific class via a choice thats made by the user. The following is the flawed code that I came up with (but doesn't 'compile' ...)

    Code:
        def packageSelect(self, event, package):
            self.package_type = package
            import ("%s" % ("" + LIB_PATH + self.package_type + "_package.py"))
            return package
    I would also like to remove the class if that is possible on demand as well.

    Any ideas?

  2. #2

    Re:Python and Dynamic Imports

    No ideas?

  3. #3

    Re:Python and Dynamic Imports

    Truth be told I"ve never seen this done.

    Does this help?

    http://forums.devshed.com/t180067/s.html
    http://mail.python.org/pipermail/pyt...ay/222723.html

    I just googled for 'python "conditional import"' and 'python dynamic import'

Similar Threads

  1. Dynamic Disk
    By omidkamangar in forum Linux - General Topics
    Replies: 2
    Last Post: 10-02-2006, 04:05 PM
  2. Dynamic IP
    By jro in forum Linux - General Topics
    Replies: 13
    Last Post: 08-09-2005, 01:43 PM
  3. Dynamic DNS
    By pyfsapple in forum Linux - Hardware, Networking & Security
    Replies: 0
    Last Post: 01-17-2003, 10:19 AM
  4. Webserver on dynamic IP
    By gmoreno in forum Linux - Hardware, Networking & Security
    Replies: 9
    Last Post: 08-18-2002, 04:32 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •