Hi, Reading bit of Python in a Nutshell, by Alex Martelli (good book, btw!) I found a possible answer/solution to my problem by chance today (thanks for various suggestions though)
What I was after is the special import mechanism, which would work around the import and peculiarities of the invenio package. This PEP is there for such purposes: http://www.python.org/dev/peps/pep-0302/ -- i haven't tried it, but it looks this is exactly what i needed. Cheers, roman On Thu, Aug 26, 2010 at 11:24 AM, Roman Chyla <[email protected]> wrote: > Hi, > > How would you go about running different versions of a module (say > bibclassify) that depends on invenio core? (assuming the module is > standalone, and the functions of the invenio core are ok for all > versions). > > I am in a funny situation where the old version has this kind of import: > > try: > from bibclassify_engine import output_keywords_for_sources > except ImportError, err: > sys.exit(0) > > try: > from invenio.bibclassify_daemon import bibclassify_daemon > except ImportError: > #.... > > The first block is relative, but the second block will import invenio > and whoops, we suddenly have a mix of new and old bibclassify modules > -- the only option, it seems, is like removing invenio link from > site-packages (btw, this global link is a source of other > difficulties, one machine cannot have several invenio installations > without additional layers of hacking - see also > http://invenio-software.org/ticket/253 - I believe we shall use rather > PYTHONPATH and egg-links to accomplish the same thing without > sacrifizing flexibility) > > Yes, my problem is very much related to the namespaces, packages and > modularity (that being an outstanding topic of discussions), but can I > do something else than edit the different version of the modules I > want to test now? How would you swap modules inside invenio for a > quick testing? > > Thank you for tips, > > roman >
