[x3d-public] python 2.7 complains about x3d.py -- and will continue to do so

Andreas Plesch andreasplesch at gmail.com
Sun Jun 14 16:26:16 PDT 2020


I only noticed because on a default, recent Debian installation, typing
'python' launches python2. 'python3' launches python3.

It is reasonable to only support python3. Python2 is not updated anymore
since this year, and python3 has been available for ten years. But I think
it will be advantageous to make this explicit to preempt potential
confusion.

-Andreas



On Sun, Jun 14, 2020 at 6:34 PM vmarchetti at kshell.com <vmarchetti at kshell.com>
wrote:

> The refence John Carlson identified suggests using a 'processing
> instruction' as the first line of the x3d.py file, the line would be:
> # -*- coding: utf-8 -*-
> and this allows the Python 2 interpreter to read the source file assuming
> UTF-8 encoding; for the current download of x3d.py (as of 12 June 2020)
> this works, Python 2 accepts the non-ascii character (in this case, the
> non-ascii character is the "MULTIPLICATION_SIGN" , unicode 215, used in a
> documentation comment.)
>
> However, elsewhere in the x3d.py, the print({text}) form of the Python
> print statement is used, and that is only permitted in Python 3.
>
> As it is written now, x3d.py is only supported by Python 3. I think this
> is a reasonable choice.
>
> Vince Marchetti
>
>
> On Jun 12, 2020, at 12:31 AM, John Carlson <yottzumm at gmail.com> wrote:
>
> https://www.python.org/dev/peps/pep-0263/   (declaring an encoding)
>
> On Thu, Jun 11, 2020 at 2:20 PM Andreas Plesch <andreasplesch at gmail.com>
> wrote:
>
>> $ python
>> Python 2.7.16 (default, Oct 10 2019, 22:02:15)
>> [GCC 8.3.0] on linux2
>> Type "help", "copyright", "credits" or "license" for more information.
>> >>> import x3d.x3d as x
>> Traceback (most recent call last):
>>  File "<stdin>", line 1, in <module>
>>  File "/home/andreas/.local/lib/python2.7/site-packages/x3d/x3d.py", line
>> 206
>> SyntaxError: Non-ASCII character '\xc3' in file
>> /home/andreas/.local/lib/python2.7/site-packages/x3d/x3d.py on line 206,
>> but no encoding declared; see http://python.org/de
>> v/peps/pep-0263/ for details
>>
>> $ cat -nA  /home/andreas/.local/lib/python2.7/site-packages/x3d/x3d.py |
>> grep 206 | head -1
>>   206      'SFMatrix3d', # Single Field (singleton) 3M-CM-^W3 matrix of
>> double-precision floating point numbers$
>>
>> There are indeed non-ascii characters.
>>
>> python3 does not complain.
>>
>> --
>> Andreas Plesch
>> Waltham, MA 02453
>> _______________________________________________
>> x3d-public mailing list
>> x3d-public at web3d.org
>> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>>
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>
>
>

-- 
Andreas Plesch
Waltham, MA 02453
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20200614/d357aefb/attachment.html>


More information about the x3d-public mailing list