On 09.08.2013 18:15, RjOllos wrote:
Do you know of a good way that we can fix that print statement to also
print correctly in Python 3.x?

from __future__ import print_function is not available until Python 2.6.

How about?:

try:
     print "Trac requires Python %d.%d or later" % min_python
except SyntaxError:
     print("Trac requires Python %d.%d or later" % min_python)

Not yet tested, so Python 3.x syntax might not be exactly correct.

As long as no "advanced" features (like arguments) are used, I assume we could simply use
    print("Trac requires Python %d.%d or later" % min_python)
directly anyway, even without `from __future__ import print_function`.

All Python 2.x versions should still accept this as the old print statement with (superfluous but harmless) parentheses around an expression.

http://python3porting.com/noconv.html#supporting-the-print-function
> The simple cases are not problematic, you can simply put parentheses
> around the text that should be printed. The following will print
> exactly the same in all versions of Python:
>
> >>> print("This works in all versions of Python!")
> This works in all versions of Python!


(For reference, I linked this thread in http://trac.edgewall.org/ticket/9595#comment:8 by the way.)

--
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to