On Tue, Apr 29, 2008 at 11:42 AM,  <[EMAIL PROTECTED]> wrote:
>
>     Alexander> The quick hack to request a version, good to use in the
>     Alexander> interpreter or a "throw-away" script:
>
>     Alexander> import pkg_resources
>     Alexander> pkg_resources.require('SQLAlchemy==0.4.5')
>     Alexander> import sqlalchemy
>
>     Alexander> This works when the directory that SQLAlchemy-0.4.5-py2.4.egg
>     Alexander> is in is listed in sys.path.
>
>  Thanks, however that raises a VersionConflict exception:
>
>
>     >>> pkg_resources.require('SQLAlchemy==0.4.5')
>     Traceback (most recent call last):
>       File "<stdin>", line 1, in ?
>       File 
> "/opt/app/g++lib6/python-2.4.5/lib/python2.4/site-packages/setuptools-0.6c7-py2.4.egg/pkg_resources.py",
>  line 626, in require
>         needed = self.resolve(parse_requirements(requirements))
>       File 
> "/opt/app/g++lib6/python-2.4.5/lib/python2.4/site-packages/setuptools-0.6c7-py2.4.egg/pkg_resources.py",
>  line 528, in resolve
>         raise VersionConflict(dist,req) # XXX put more info here 
> pkg_resources.VersionConflict: (SQLAlchemy 0.3.3
>     
> (/opt/app/g++lib6/python-2.4.5/lib/python2.4/site-packages/SQLAlchemy-0.3.3-py2.4.egg),
>  Requirement.parse('SQLAlchemy==0.4.5'))
>
>  I need 0.3.3 to be the default version, but need to be able to import 0.4.5
>  for testing.

Ah. Yes. I install everything --multi-version so I have forgotten
about this issue with the default working set. Maybe

__requires__ = ['SQLAlchemy==0.4.5']
import pkg_resources
import sqlalchemy

will help pkg_resources create the desired WorkingSet.
_______________________________________________
Distutils-SIG maillist  -  Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to