PR extended-Numberzap
https://github.com/D...cafe04f588ae9e2
Nodejs is removed from feed since September, 2021.
I'll reinstate it.
Mediaportal has added nodejs as dependency apparently.
Kodi: Still big problem.
How is that ever going to work? That is not valid syntax. Even if it is in a "PY2" block, it still has to be valid Py3 syntax or it will crash in Py3.
Python 3.10.2 (main, Jan 13 2022, 19:06:22) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import six
>>>
>>> if six.PY2:
... exec "1+1"
File "<stdin>", line 2
exec "1+1"
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'exec'. Did you mean exec(...)?
>>>
Just add the parenthesis, not the if block:
# Python 2 only:
exec 'x = 10'
# Python 2 and 3:
exec('x = 10')
Works fine in python2:
Python 2.7.16 (v2.7.16:413a49145e, Mar 4 2019, 01:37:19) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> exec("1+1")
>>>
Your code is doing the same as this:
import six
if six.PY2:
print "xyz"
else:
print("xyz")
And will end up like this:
root@vuultimo4k:/tmp# python v.py
File "/var/volatile/tmp/v.py", line 3
print "xyz"
^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
root@vuultimo4k:/tmp#
Edited by Huevos, 9 March 2022 - 09:16.