[Biopython-dev] README and python3
Peter
biopython at maubp.freeserve.co.uk
Thu Oct 28 05:17:09 EDT 2010
2010/10/27 Tiago Antão <tiagoantao at gmail.com>:
> Hi,
>
> Just a minor issue with the README and python3.
> The option --nofix does not exist in 2to3 for the 2.x version. So that
> line will not work if the 2to3 happens to be from Python 2.X (can
> happen if you have several versions installed).
>
Hi Tiago,
Can you work out which version of 2to3 lacks the --nofix (or -x)
option, and which version of Python it came from?
The (Apple provided) Python 2.6.1 on my Mac seems to have
a 2to3 with the --nofix option, and I don't have Python 3 installed
on this machine. In addition to running 2to3 as a command line
script, you can call the library from within Python:
$ python2.6
Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from lib2to3.main import main
>>> main("lib2to3.fixes", ["--help"])
Usage: refactor.py [options] file|dir ...
Options:
-h, --help show this help message and exit
-d, --doctests_only Fix up doctests only
-f FIX, --fix=FIX Each FIX specifies a transformation; default: all
-x NOFIX, --nofix=NOFIX
Prevent a fixer from being run.
-l, --list-fixes List available transformations (fixes/fix_*.py)
-p, --print-function Modify the grammar so that print() is a function
-v, --verbose More verbose logging
-w, --write Write back modified files
-n, --nobackups Don't write backups for modified files.
Likewise on our Linux server the 2to3 from Python 2.6.6, 2.7 and
3.1.2 all seem to have it:
$ python2.6
Python 2.6.6 (r266:84292, Aug 31 2010, 16:21:14)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from lib2to3.main import main
>>> main("lib2to3.fixes", ["--help"])
Usage: 2to3 [options] file|dir ...
Options:
-h, --help show this help message and exit
-d, --doctests_only Fix up doctests only
-f FIX, --fix=FIX Each FIX specifies a transformation; default: all
-j PROCESSES, --processes=PROCESSES
Run 2to3 concurrently
-x NOFIX, --nofix=NOFIX
Prevent a fixer from being run.
-l, --list-fixes List available transformations
-p, --print-function Modify the grammar so that print() is a function
-v, --verbose More verbose logging
--no-diffs Don't show diffs of the refactoring
-w, --write Write back modified files
-n, --nobackups Don't write backups for modified files.
$ python2.7
Python 2.7 (r27:82500, Jul 13 2010, 14:02:41)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from lib2to3.main import main
>>> main("lib2to3.fixes", ["--help"])
Usage: 2to3 [options] file|dir ...
Options:
-h, --help show this help message and exit
-d, --doctests_only Fix up doctests only
-f FIX, --fix=FIX Each FIX specifies a transformation; default: all
-j PROCESSES, --processes=PROCESSES
Run 2to3 concurrently
-x NOFIX, --nofix=NOFIX
Prevent a fixer from being run.
-l, --list-fixes List available transformations
-p, --print-function Modify the grammar so that print() is a function
-v, --verbose More verbose logging
--no-diffs Don't show diffs of the refactoring
-w, --write Write back modified files
-n, --nobackups Don't write backups for modified files.
$ python3.1
Python 3.1.2 (r312:79147, Jul 15 2010, 12:43:37)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from lib2to3.main import main
>>> main("lib2to3.fixes", ["--help"])
Usage: 2to3 [options] file|dir ...
Options:
-h, --help show this help message and exit
-d, --doctests_only Fix up doctests only
-f FIX, --fix=FIX Each FIX specifies a transformation; default: all
-j PROCESSES, --processes=PROCESSES
Run 2to3 concurrently
-x NOFIX, --nofix=NOFIX
Prevent a fixer from being run.
-l, --list-fixes List available transformations (fixes/fix_*.py)
-p, --print-function Modify the grammar so that print() is a function
-v, --verbose More verbose logging
--no-diffs Don't show diffs of the refactoring
-w, --write Write back modified files
-n, --nobackups Don't write backups for modified files.
Note that we *need* the --nofix option for the conversion of
Bio.Phylo to work (it uses long as an argument name,
short longitude).
Peter
More information about the Biopython-dev
mailing list