Closed sydoluciani closed 3 years ago
Sydo Luciani wrote at 2020-12-7 21:55 -0800:
What I did:
Starting Plone docker container throw below Syntax Errors:
What I expect to happen:
Expecting those files being both Python 2 and Python 3 compatible.
What actually happened:
File "/plone/buildout-cache/eggs/zodbpickle-2.0.0-py3.8-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 "/plone/buildout-cache/eggs/zodbpickle-2.0.0-py3.8-linux-x86_64.egg/zodbpickle/pickle_2.py", line 882 except _Stop, stopinst: ^ SyntaxError: invalid syntax File "/plone/buildout-cache/eggs/zodbpickle-2.0.0-py3.8-linux-x86_64.egg/zodbpickle/tests/pickletester_2.py", line 433 x = [0, 1L, 2.0, 3.0+0j] ^ SyntaxError: invalid syntax
zodbpickle
has different (sub) modules for Python 2 and Python 3,
differentiated via a _2
and _3
suffixes.
(Sub) modules without suffix multiplex according to the used Python version.
The problem above comes from using Python 3 with modules targeting Python 2. Thus, your setup is wrong.
The question is, what is that Docker container trying to do? Is it running python3 -m compileall
or something? Because zodbpickle itself will not be trying to import Python 2 specific modules on Python 3.
(I'm not opposed to making python3 -m compileall
work without emitting scary-looking SyntaxErrors even on code that's not supposed to work on Python 3, assuming that's practical. It may not be.)
Just a guess: I don't know about plone docker, but I see it uses buildout. When running buildout I often see similar "errors" on the console (that are not fatal) caused by this code https://github.com/buildout/buildout/blob/6e00617ec15cb23dd3fd00b159e1df3497b72e1f/src/zc/buildout/easy_install.py#L1613-L1618
Thank you for quick response, I can see that .travis.yml is calling test_suit to identify version of python, but the same logic has not been included in tox.ini, so the same tests can't be running locally by running tox command, and Plone developers needs to implement the same logic on their end to prevent those errors. all those errors are caused by running pytest or unittest against zodbpickle tests directory.
I guess we can wait until Zope drops Python 2 support alltogether, those errors are harmless for now.
Closing the issue.
Thanks again.
BUG/PROBLEM REPORT (OR OTHER COMMON ISSUE)
What I did:
Starting Plone docker container throw below Syntax Errors:
What I expect to happen:
Expecting those files being both Python 2 and Python 3 compatible.
What actually happened:
What version of Python and Zope/Addons I am using:
Python 3
Debian