Syntax error (Plone 5.2.1 Unified installer buildout)

I created a new plone instance with the unified installer 5.2.1 and used --build-pytheon on a Debian 10 machine. When I then run buildout, I get the forllowing output. In particular the "Syntax errors" bother me. What should I do?

Preformatted textUninstalling precompiler.
Uninstalling zopepy.
Uninstalling client2.
Uninstalling client1.
Updating zeoserver.
Installing client1.
Generated script '/zlocal/sdb1/plone/Plone/zeocluster/bin/client1'.
Generated interpreter '/zlocal/sdb1/plone/Plone/zeocluster/parts/client1/bin/interpreter'.
Installing client2.
Generated script '/zlocal/sdb1/plone/Plone/zeocluster/bin/client2'.
Generated interpreter '/zlocal/sdb1/plone/Plone/zeocluster/parts/client2/bin/interpreter'.
Updating backup.
Installing zopepy.
Generated interpreter '/zlocal/sdb1/plone/Plone/zeocluster/bin/zopepy'.
Updating unifiedinstaller.
Installing precompiler.
Compiling Python files.
  File "/zlocal/sdb1/plone/Plone/buildout-cache/eggs/zodbpickle-1.0.4-py2.7-linux-x86_64.egg/zodbpickle/pickletools_3.py", line 2049
    print("%5d:" % pos, end=' ', file=out)
                           ^
SyntaxError: invalid syntax

  File "/zlocal/sdb1/plone/Plone/buildout-cache/eggs/zodbpickle-1.0.4-py2.7-linux-x86_64.egg/zodbpickle/pickle_3.py", line 178
    def __init__(self, file, protocol=None, *, fix_imports=True):
                                             ^
SyntaxError: invalid syntax

  File "/zlocal/sdb1/plone/Plone/buildout-cache/eggs/zodbpickle-1.0.4-py2.7-linux-x86_64.egg/zodbpickle/tests/pickletester_3.py", line 142
    class use_metaclass(object, metaclass=metaclass):
                                         ^
SyntaxError: invalid syntax

Compiling locale files.
Updating setpermissions.
setpermissions: Running # Dummy references to force this to execute after referenced parts
echo /zlocal/sdb1/plone/Plone/zeocluster/var/backups yes > /dev/null
chmod 600 .installed.cfg
# Make sure anything we've created in var is r/w by our group
find /zlocal/sdb1/plone/Plone/zeocluster/var -type d -exec chmod 770 {} \; 2> /dev/null
find /zlocal/sdb1/plone/Plone/zeocluster/var -type f -exec chmod 660 {} \; 2> /dev/null
find /zlocal/sdb1/plone/Plone/zeocluster/var -type d -exec chmod 770 {} \; 2> /dev/null
find /zlocal/sdb1/plone/Plone/zeocluster/var -type f -exec chmod 660 {} \; 2> /dev/null
chmod 754 /zlocal/sdb1/plone/Plone/zeocluster/bin/*

The code seems to use Python 3.7+ or 3.8+ specific functionality but your Python version is 2.7...some mismatch for some reason...

I suspected this, but how can this be if I used unified installer and --build-python. I would have expeced that then everything would work.

How would I specify to build python 3.7 during install?

More important question, I have not seen that PloneFormGen works with Python3, am I wrong?

Followup question?

Does that mean I cannot use Plone 5.2.1 with Python 2.7.15

~/Plone/Python-2.7/bin/python --version
Python 2.7.15

You can specify --build-python=3; this should build a Python 3 interpreter. Current master branch of the UnifiedInstaller will build a version 3.8.5; but I'm not sure about how to update the distribution.

You can, it works.

Errors that occur during the precompile phase of the build are often not fatal. In this case, the files that failed to compile are all Python3-specific files included in the distribution for testing or other purposes.

If the install completes without error, you may generally ignore "precompiler" warnings.

Hello Steve,

you wrote "errors in the precompile phase are often not fatal".
However, that kind of errors shouldn't be visible to someone who runs buildout and is supposed to ignore them. What indication do I have that I can ignore them?

For example, now with an already installed python 3.7.3 on Debian10, I get the following when I run buildout on the vanilla buildout.cfg that I got from Plone-5.2.1-UnifiedInstaller-r3.tgz.

If that is a problem with Python2 syntax, then why does it show up if Plone-5.2.1 is supposed to with with Python 3.7?

The Plone community certainly does a good job, but I would wish that errors that can be ignored should not show up. Do you think that would be achievable in future Plone versions?

Installing precompiler.
Compiling Python files.
  File "/zlocal/sdb1/plone/Plone-5.2.1_portal-risc_2020-08-10_with-python-3.7.3/buildout-cache/eggs/plone.staticresources-1.2.1-py3.7.egg/plone/staticresources/static/components/cs-jqtree-contextmenu/node_modules/jqtree/_entries/insert.py", line 44
    print 'rename %s to %s' % (old_filename, new_filename)
                          ^
SyntaxError: invalid syntax

  File "/zlocal/sdb1/plone/Plone-5.2.1_portal-risc_2020-08-10_with-python-3.7.3/buildout-cache/eggs/plone.staticresources-1.2.1-py3.7.egg/plone/staticresources/static/components/cs-jqtree-contextmenu/node_modules/jqtree/_entries/renumber.py", line 36
    print 'rename %s to %s' % (old_filename, new_filename)
                          ^
SyntaxError: invalid syntax

  File "/zlocal/sdb1/plone/Plone-5.2.1_portal-risc_2020-08-10_with-python-3.7.3/buildout-cache/eggs/plone.staticresources-1.2.1-py3.7.egg/plone/staticresources/static/components/jqtree/_entries/insert.py", line 44
    print 'rename %s to %s' % (old_filename, new_filename)
                          ^
SyntaxError: invalid syntax

  File "/zlocal/sdb1/plone/Plone-5.2.1_portal-risc_2020-08-10_with-python-3.7.3/buildout-cache/eggs/plone.staticresources-1.2.1-py3.7.egg/plone/staticresources/static/components/jqtree/_entries/renumber.py", line 36
    print 'rename %s to %s' % (old_filename, new_filename)
                          ^
SyntaxError: invalid syntax

  File "/zlocal/sdb1/plone/Plone-5.2.1_portal-risc_2020-08-10_with-python-3.7.3/buildout-cache/eggs/zodbpickle-1.0.4-py3.7-linux-x86_64.egg/zodbpickle/pickle_2.py", line 882
    except _Stop, stopinst:
                ^
SyntaxError: invalid syntax

  File "/zlocal/sdb1/plone/Plone-5.2.1_portal-risc_2020-08-10_with-python-3.7.3/buildout-cache/eggs/zodbpickle-1.0.4-py3.7-linux-x86_64.egg/zodbpickle/pickletools_2.py", line 1803
    print "skipping %r: it doesn't look like an opcode name" % name
                                                           ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("skipping %r: it doesn't look like an opcode name" % name)?

  File "/zlocal/sdb1/plone/Plone-5.2.1_portal-risc_2020-08-10_with-python-3.7.3/buildout-cache/eggs/zodbpickle-1.0.4-py3.7-linux-x86_64.egg/zodbpickle/tests/pickletester_2.py", line 433
    x = [0, 1L, 2.0, 3.0+0j]
             ^
SyntaxError: invalid syntax

Compiling locale files.

The precompiler does (by default) ignore whole classes of SyntaxErrors that are harmless and expected (for example, a return outside a function, common for skin scripts).

A case could be made that this feature should be extended to cover errors hitting Python-version-specific code. 5.2.x is a transitional platform, though, and it would probably be hard to get someone to do that work when we know 2.7.x is deprecated.

A better case could be made for putting a warning in the docs, or even have it issued by the installer as part of the build. We used to do that before the "quiet" feature was added to the precompiler.

I suggest filing this as a documentation issue on the installer.