Changes between Initial Version and Version 1 of Ticket #8313, comment 8


Ignore:
Timestamp:
Jan 18, 2023, 4:50:14 PM (3 years ago)
Author:
Tom Goddard

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #8313, comment 8

    initial v1  
    1 As indicated in the preceding comment Python is returning _locale.nl_langinfo(CODESET) = 'ANSI_X4.3-1968' instead of the expected 'UTF-8' for no reason I could figure out.  Based on the documented behavior of Linux system calls nl_langinfo() and setlocale() that are being used by Python 3.8 this behavior seems wrong.  No doubt I am missing something.
     1As indicated in the preceding comment Python is returning _locale.nl_langinfo(CODESET) = 'ANSI_X4.3-1968' instead of the expected 'UTF-8' for no reason I could figure out.  Based on the documented behavior of C library calls nl_langinfo() and setlocale() that are being used by Python 3.8 this behavior seems wrong.  No doubt I am missing something.
    22
    33A new hack to work around this problem is to replace _locale.nl_langinfo(CODESET) in Python so that it always returns UTF-8.  I've tested that and it seems to work on multiple AlphaFold prediction runs in the same Google Colab session with minimization.  The default pathlib and open() files created for writing properly get UTF-8 encoding.  My previous work around solution of monkey patching locale.getpreferredencoding() did not fix the encoding of those opened files so only the first AlphaFold prediction was working with that solution.