Module import hook

2013-04-16 Thread Thomas Calmant
Hi, For the context, I'm working on Pelix (https://github.com/tcalmant/ipopo), a service-oriented architecture framework (in GPLv3), inspired by OSGi (from the Java world). It runs on Python >= 2.6 (with the backport of importlib) and Python 3.1 (not tested upon this version). It considers Python

Re: multiversion flag and auto requiring import hook

2012-01-19 Thread Andrea Crotti
... Actually the main problem which I've been banging my head quite a few days alreays is this: --8<---cut here---start->8--- ERROR: Failure: AttributeError ('module' object has no attribute 'walk')

multiversion flag and auto requiring import hook

2012-01-19 Thread Andrea Crotti
best way would be to use python setup.py test, which would make everything needed for the tests available. The problem is that it's very slow to run and harder to integrate in Eclipse, so I created an import hook, that tries to do a pkg_resources.require first. The test runner should do some

Re: simple import hook

2011-11-14 Thread DevPlayer
An alternative approach: http://pastebin.com/z6pNqFYE or: # devpla...@gmail.com # 2011-Nov-15 # recordimports.py # my Import Hook Hack in response to: # http://groups.google.com/group/comp.lang.python/browse_thread/thread/5a5d5c724f142eb5?hl=en # as an initial learning exercise # This code

Re: simple import hook

2011-11-10 Thread Andrea Crotti
On 11/10/2011 05:02 PM, Eric Snow wrote: Yeah, I'm working on a reference for imports in Python. They're just a little too mysterious relative to the rest of the language. But it's not too helpful yet. In the meantime... Yes it's quite mysterious, and it's actually not as hard as it looks..

simple import hook

2011-11-10 Thread Andrea Crotti
So I would really like to accomplish the following: run a program normally and keep track of all the imports that were actually done. I studied the PEP 302, but I'm still a bit confused about how to do it. I thought that instead of implementing everything I could just record the request and

Map-based module imports with import hook

2011-08-01 Thread mpj
nes/porter Which implements an import hook (PEP 302) that can be set up to look at an environment variable with the following format: name=location[:name=location[:name=location[:...]]] This is parsed into a standard dict and used for quick lookups when possible, falling back to the standard Pyt

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

import hook

2006-06-11 Thread Jeremy Sanders
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 site-packages, so by doing "import foo.bar", it should start lo

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)

import hook, overwrite import?

2005-01-25 Thread Torsten Mohr
Hi, is there some description available to overwrite the import hook? By googling i found out so far that i need to overwrite __builtins__.__import__ with something else. Can i also do this with a C function that is provided when using an embedded python interpreter? So my own C program