[New-bugs-announce] [issue3553] "2to3 -l" doesn't work when installed in /opt

STINNER Victor report at bugs.python.org
Thu Aug 14 17:44:56 CEST 2008


New submission from STINNER Victor <haypo at users.sourceforge.net>:

I just installed Python 3.0b2 in /opt/py3k and tried 2to3 tool:

$ /opt/py3k/bin/2to3 -l
Available transformations for the -f/--fix option:
Traceback (most recent call last):
  File "/opt/py3k/bin/2to3", line 5, in <module>
    sys.exit(refactor.main("lib2to3/fixes"))
  File "/opt/py3k/lib/python3.0/lib2to3/refactor.py", line 69, in main
    for fixname in get_all_fix_names(fixer_dir):
  File "/opt/py3k/lib/python3.0/lib2to3/refactor.py", line 102, in 
get_all_fix_names
    names = os.listdir(fixer_dir)
OSError: [Errno 2] No such file or directory: 'lib2to3/fixes'

fixer_dir is the relative directory name "lib2to3/fixes", it should be 
an absolute directory. Example (ugly code copied from 
RefactoringTool.get_fixers()) to get the full path in refactor.py 
(main function):

    if not os.path.isabs(fixer_dir):
        fixer_pkg = fixer_dir.replace(os.path.sep, ".")
        if os.path.altsep:
            fixer_pkg = fixer_pkg.replace(os.path.altsep, ".")
        mod = __import__(fixer_pkg, {}, {}, ["*"])
        fixer_dir = os.path.dirname(mod.__file__)

----------
assignee: collinwinter
components: 2to3 (2.x to 3.0 conversion tool)
messages: 71132
nosy: collinwinter, haypo
severity: normal
status: open
title: "2to3 -l" doesn't work when installed in /opt
versions: Python 3.0

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3553>
_______________________________________


More information about the New-bugs-announce mailing list