[reportlab-users] import/as

Jeff Bauer reportlab-users@reportlab.com
Sun, 19 Jan 2003 06:36:21 -0600


I'm still running some old pre-Zope Bobo services
that require "classic" Python 1.5.2.

This isn't really a problem for me, as I can run
multiple versions of Python on the same machine.
Also I'm considering a separate "Report Generator"
machine/process (TwistedMatrix, anyone?) as an
possible approach.

Anyway, compiling the ReportLab 1.17 with Python 1.5.2
generates a couple of errors in non-essential portions
of the distribution:

  Compiling ./demos/odyssey/dodyssey.py ...
  File "./demos/odyssey/dodyssey.py", line 16
    from rlextra.radxml.para import Paragraph as PPPP
                                               ^
  SyntaxError: invalid syntax

  Compiling ./demos/rlzope/rlzope.py ...
  File "./demos/rlzope/rlzope.py", line 22
    from Shared.PIL import Image as PIL_Image
                                  ^
  SyntaxError: invalid syntax

If Python 1.5.2 compatibility is a goal (it's not
critical for my work), a simple backwards-compatible
idiom is to replace:

  from XXX import YYY as ZZZ

with:

  from XXX import YYY; ZZZ=YYY; del YYY

Cheers,

Jeff