like "import" retreives coding in flat files, is there a way to retreive
coding for a DB ?
something like :
db.open('db')
db.dbimport('module1')
print module1.test()
where 'time' whas previously save into the DB as a Python code :
class module1:
def test(self):
print "work"
Thanks
imp module should do the trick
http://www.python.org/doc/current/lib/module-imp.html
You can write your own version of __import__ and set it as the
thus-named attribute of the __builtin__ module -- statements
import and from will thereafter use your version rather than
the built-in kind. Is this what you want...?
Alex
Alex> You can write your own version of __import__ ...
I believe there was a custom __import__ floating around at one time that
allowed imports from zipfiles (part of some sort of freeze tool that Fredrik
Lundh wrote, perhaps?). If that code can be located, it would probably
serve as a useful template for importing code from other structured files.
Sorry, my memory is foggy on the details.
--
Skip Montanaro (sk...@pobox.com)
http://www.mojam.com/
http://www.musi-cal.com/
| I believe there was a custom __import__ floating around at one time that
| allowed imports from zipfiles (part of some sort of freeze tool that Fredrik
| Lundh wrote, perhaps?).
<URL: http://starship.python.net/crew/gmcm/archives.html> ?
-- erno