2009-09-20 19:30:54 Nirbheek Chauhan napisał(a): > On Sun, Sep 20, 2009 at 8:54 PM, Arfrever Frehtes Taifersar Arahesis > wrote: > > 2009-09-20 16:53:37 Jesús Guerrero napisał(a): > >> # eselect python set 2 > >> # emerge -s foo > >> File "/usr/bin/emerge", line 41 > >> except PermissionDenied, e: > >> ^ > >> SyntaxError: invalid syntax > >> > >> > >> Ummm, yes, it works *beautifully*, you see. Nothing else to add. > > > > I have fixed it today :) . > > http://sources.gentoo.org/viewcvs.py/portage?rev=14289&view=rev > > This is silly. portage itself was broken with python-3.1 and you want > to stabilize it? You should distinguish between Python version used by Portage and Python version used by packages which can be installed by Portage. > Actually, how did you make portage work with both 2.x and 3.x at the > same time? Portage doesn't yet work with Python 3, but it hopefully change soon. > I would be very interested to know this since afaik no useful program > can work with both python-3 and python-2 with the same code. It isn't hard to write code which works with both Python 2.6 and 3.*. Example: $ cat get_protocol.py #!/usr/bin/env python # It allows to use print() function in 2.6. from __future__ import print_function import sys try: # Python 3 from urllib.parse import urlparse as urllib_parse_urlparse except ImportError: # Python 2 from urlparse import urlparse as urllib_parse_urlparse if len(sys.argv) != 2: sys.stderr.write("This script requires 1 argument: URL\n") def get_protocol(url): return urllib_parse_urlparse(url)[0] print("Protocol:", get_protocol(sys.argv[1])) $ ./get_protocol.py http://www.example.com Protocol: http -- Arfrever Frehtes Taifersar Arahesis