Re: import hook

2006-06-18 Thread Jeremy Sanders
Thomas Heller wrote: > There are also other ways. You could extend __path__ of foo, and the > pkgutil module might also be useful. The __path__ trick worked nicely, thanks. Here is the code in case anyone is interested # Allow veusz to be run even if not installed into PYTHONPATH try: impor

Re: import hook

2006-06-11 Thread Thomas Heller
Alex Martelli wrote: > Jeremy Sanders <[EMAIL PROTECTED]> wrote: > >> Hi - Is it possible to override the import process so that if in my program >> I do >> >> import foo.bar >> >> Python will look for bar in a directory which isn't called foo? >> >> I want my module/program to be able to be ru

Re: import hook

2006-06-11 Thread Alex Martelli
Jeremy Sanders <[EMAIL PROTECTED]> wrote: > Hi - Is it possible to override the import process so that if in my program > I do > > import foo.bar > > Python will look for bar in a directory which isn't called foo? > > I want my module/program to be able to be run without being installed in > si

Re: import hook

2006-06-11 Thread Rune Strand
Jeremy Sanders wrote: > Hi - Is it possible to override the import process so that if in my program > I do (...) > > Any ideas? Why not handle the foo.bar/version string separately and just append the resulting path to sys.path? -- http://mail.python.org/mailman/listinfo/python-list

Re: import hook, overwrite import?

2005-01-27 Thread Steve Holden
Kartic wrote: Hi Torsten, If you want to use other methods to import (other than good ole file system), yes, you can create an importer class and register it as an importer module, that import will use to search and import. For example, it is possible to use zip imports (this functionality is alrea

Re: import hook, overwrite import?

2005-01-26 Thread Kartic
Hi Torsten, If you want to use other methods to import (other than good ole file system), yes, you can create an importer class and register it as an importer module, that import will use to search and import. For example, it is possible to use zip imports (this functionality is already builtin)