Thanks, that’s very helpful. Looks like I need to tell pylit about the encodings explicitly.

 

Regards,

 

David

 

From: <firedrake-bounces@imperial.ac.uk> on behalf of "Acreman, David" <D.M.Acreman@exeter.ac.uk>
Reply-To: firedrake <firedrake@imperial.ac.uk>
Date: Thursday, 11 October 2018 at 17:02
To: firedrake <firedrake@imperial.ac.uk>
Subject: Re: [firedrake] Fix for problem with Monge-Ampere demo

 

Hi David, 

 

The traceback is:

 

Traceback (most recent call last):
  File "/path/to/firedrake/firedrake/src/firedrake/tests/demos/../../pylit/pylit.py", line 1764, in <module>
    main()
  File "/path/to/firedrake/firedrake/src/firedrake/tests/demos/../../pylit/pylit.py", line 1729, in main
    out_stream.write(str(converter))
  File "/path/to/firedrake/firedrake/src/firedrake/tests/demos/../../pylit/pylit.py", line 523, in __str__
    return "".join(self())
  File "/path/to/firedrake/firedrake/src/firedrake/tests/demos/../../pylit/pylit.py", line 513, in __call__
    return [line for line in self]
  File "/path/to/firedrake/firedrake/src/firedrake/tests/demos/../../pylit/pylit.py", line 513, in <listcomp>
    return [line for line in self]
  File "/path/to/firedrake/firedrake/src/firedrake/tests/demos/../../pylit/pylit.py", line 599, in convert
    for block in collect_blocks(expandtabs_filter(lines)):
  File "/path/to/firedrake/firedrake/src/firedrake/tests/demos/../../pylit/pylit.py", line 1082, in collect_blocks
    for line in lines:
  File "/path/to/firedrake/firedrake/src/firedrake/tests/demos/../../pylit/pylit.py", line 1062, in expandtabs_filter
    for line in data:
  File "/gpfs/ts0/shared/software/Python/3.5.2-foss-2016b/lib/python3.5/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 41: ordinal not in range(128)

and I see the same traceback if I run pylit on the input file directly (i.e. run pylit/pylit.py demos/ma-demo/ma-demo.py.rst from firedrake/src/firedrake). 


Regards, 

Dave 

On 11 Oct 2018, at 15:40, Ham, David A <david.ham@imperial.ac.uk> wrote:

 

Hi Dave,

 

This is really rather odd. Do you happen to have the exception lying around somewhere? E.g. does the problem occur when the demo is run, or maybe when pylit is run on the input rst file? We ought to be able to fix this within Firedrake in an environment-independent way but it depends a bit on where the issue occurs.

 

Regards,

 

David

 

From: <firedrake-bounces@imperial.ac.uk> on behalf of "Acreman, David" <D.M.Acreman@exeter.ac.uk>
Reply-To: firedrake <firedrake@imperial.ac.uk>
Date: Thursday, 11 October 2018 at 11:28
To: firedrake <firedrake@imperial.ac.uk>
Subject: [firedrake] Fix for problem with Monge-Ampere demo

 

Hi all, 

 

I ran into a slightly odd problem running one of the demos and thought it would be useful to post the solution in case anyone else is having the same problem. 

 

The problem was triggered by a non-ascii character in the Monge-Ampere demo (ma-demo) which showed up as a failure when running the test suite. The resulting error message is: 

 

UnicodeDecodeError: ’ascii’ codec can’t decode byte 0xc3 in position 41: ordinal not in range(128)

 

This can be fixed by setting the LC_ALL environment variable e.g. for bash-like shells 

 

export LC_ALL=en_US.utf-8

 

You can check the encoding by running 

 

python3 -c 'import sys; print(sys.stdin.encoding)’

 

which should report "UTF-8” with the environment variable set. 

 

The encoding usually seems to work correctly but didn’t on our local cluster. 

 

Regards, 

Dave

 

Dr. David Acreman,

Senior Research Fellow,
College of Engineering, Mathematics and Physical Sciences,
University of Exeter,
Stocker Road,
Exeter EX4 4QL

 

 

 




_______________________________________________
firedrake mailing list
firedrake@imperial.ac.uk
https://mailman.ic.ac.uk/mailman/listinfo/firedrake