Is this a known futurize problem?

Skip Montanaro skip.montanaro at
Thu Jul 12 22:00:51 EDT 2018

I'm using futurize to update the SpamBayes codebase to Python 3. It
doesn't seem to properly handle code which already has __future__
imports. When it wants to insert imports, it blindly puts them ahead
of the earliest import, even if it happens to be a __future__ import.
For example, here's the first diff chunk of

diff --git a/spambayes/testtools/ b/spambayes/testtools/
index 12eee81..5d8936f 100644
--- a/spambayes/testtools/
+++ b/spambayes/testtools/
@@ -31,7 +31,10 @@ If you only want to use some of the messages in each set,
 In addition, an attempt is made to merge bayescustomize.ini into the options.
 If that exists, it can be used to change the settings in Options.options.
+from __future__ import print_function

+from builtins import zip
+from builtins import range
 from __future__ import generators

 import os

I'm using version 0.16.0 (which appears to be the latest) with just
the -0 and -w flags.


More information about the Python-list mailing list