Skip to content

UnicodeDecodeError when reading Entrez handle with Python 3.6 but not with Python 2.7 #1402

Open

Description

@BioGeek

Setup

I am reporting a problem wich works with Python 2.7 but fails with Python 3.6

Full details:
The sample script below works on a system where

import sys; print(sys.version)
print(sys.getdefaultencoding())
import platform; print(platform.python_implementation()); print(platform.platform())
import Bio; print(Bio.__version__)

(note that I added a line with the default encoding), returns

2.7.11 (v2.7.11:6d1b6a68f775, Dec  5 2015, 20:32:19) [MSC v.1500 32 bit (Intel)]
ascii
CPython
Windows-7-6.1.7601-SP1
1.67

but fails on a system with:

3.6.1 |Anaconda 4.4.0 (64-bit)| (default, May 11 2017, 13:25:24) [MSC v.1900 64 bit (AMD64)]
utf-8
CPython
Windows-10-10.0.16299-SP0
1.69

Expected behaviour

The script:

from Bio import Entrez
Entrez.email = '[email protected]'
handle = Entrez.efetch(db="gds", id='200079209')
print(handle.read())

returns on the system with Python 2.7:

1. Airway epithelial cells from smokers with and without bronchial premalignant lesions
(Submitter supplied) While lung cancer is the leading cause of cancer death in the US, we have a limited understanding of the earliest molecular events preceding the onset of disease. Prior work has demonstrated that cigarette smoke creates a molecular “field of injury” throughout the airway epithelium and that there are distinct alterations in the airway transcriptome among smokers who have lung cancer. Molecular characterization of this airway “field of injury” in current and former smokers with premalignant lesions (PMLs) could provide novel insights into the earliest molecular events associated with lung carcinogenesis and identify relatively accessible biomarkers to guide lung cancer detection and early intervention. more...
Organism:	Homo sapiens
Type:		Expression profiling by high throughput sequencing
Platform: GPL16791 82 Samples
FTP download: GEO (TSV) ftp://ftp.ncbi.nlm.nih.gov/geo/series/GSE79nnn/GSE79209/
SRA Run Selector: https://www.ncbi.nlm.nih.gov/Traces/study/?acc=PRJNA315161
Series		Accession: GSE79209	ID: 200079209

Actual behaviour

But on the system with Python 3.6, it returns:

Traceback (most recent call last):
  File "c:/Users/jeroen/Documents/Code Snippets/Python/BioPython/unicode_bug.py", line 11, in <module>
    print(handle.read())
  File "C:\Users\jeroen\AppData\Local\Continuum\Anaconda3\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 362: character maps to <undefined>

Steps to reproduce

The problem seems to be that Python 3.6 tries to decode the handle with encoding cp1252.

The character at position 362 that seems to be causing the error is the closing quote at the end of “field of injury”. When I do print handle.read()[362] on the system with Python 2.7 I get: ン.

Also see this stackoverflow question for a related problem.

Activity

  1. peterjc commented on Oct 6, 2017

    @peterjc
    Member

    I've never seen any clear documentation from the NCBI on what encoding they use, and it is most unfortunate when they use non UTF8 characters. That said, the example works for me which suggests closer examination of the locale settings and these fancy quote characters...

    $ python3 gds_encoding.py 
    3.4.1 (default, Aug 30 2014, 09:38:58) 
    [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)]
    utf-8
    CPython
    Darwin-16.4.0-x86_64-i386-64bit
    1.71.dev0
    
    1. Airway epithelial cells from smokers with and without bronchial premalignant lesions
    (Submitter supplied) While lung cancer is the leading cause of cancer death in the US, we have a limited understanding of the earliest molecular events preceding the onset of disease. Prior work has demonstrated that cigarette smoke creates a molecular “field of injury” throughout the airway epithelium and that there are distinct alterations in the airway transcriptome among smokers who have lung cancer. Molecular characterization of this airway “field of injury” in current and former smokers with premalignant lesions (PMLs) could provide novel insights into the earliest molecular events associated with lung carcinogenesis and identify relatively accessible biomarkers to guide lung cancer detection and early intervention. more...
    Organism:	Homo sapiens
    Type:		Expression profiling by high throughput sequencing
    Platform: GPL16791 82 Samples
    FTP download: GEO (TSV) ftp://ftp.ncbi.nlm.nih.gov/geo/series/GSE79nnn/GSE79209/
    SRA Run Selector: https://www.ncbi.nlm.nih.gov/Traces/study/?acc=PRJNA315161
    Series		Accession: GSE79209	ID: 200079209
    
    

    You may need to report this to the NCBI...

    See also #1361 where some invalid characters had entered the GenBank database, but there at least the NCBI is reasonably clear that the GenBank files should be plain ASCII only.

  2. peterjc commented on Oct 6, 2017

    @peterjc
    Member

    This reproduces it - definitely something about the locale settings:

    $ LC_CTYPE=C python3 gds_encoding.py 
    3.4.1 (default, Aug 30 2014, 09:38:58) 
    [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)]
    utf-8
    CPython
    Darwin-16.4.0-x86_64-i386-64bit
    1.71.dev0
    Traceback (most recent call last):
      File "gds_encoding.py", line 9, in <module>
        print(handle.read())
      File "/Users/peterjc/lib/python3.4/encodings/ascii.py", line 26, in decode
        return codecs.ascii_decode(input, self.errors)[0]
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 342: ordinal not in range(128)
    
  3. BioGeek commented on Oct 8, 2017

    @BioGeek
    ContributorAuthor
  4. BioGeek commented on Oct 11, 2017

    @BioGeek
    ContributorAuthor

    The reply from NCBI was:

    Hi,

    Thanks for writing to us.

    We wills not be able to look into the issue through 3rd party package due to limited resources. To look into the issue, we will need to know the specific format you are requesting and check the output directly from our API service.

    Please write back with details on what format of this record you are requestign and through which API function (efetch or esummary, text, XML, or json).

    Your understanding will be greatly appreciated.

    Regards,

    Tao Tao, PhD
    NCBI User Services

    Not sure what I should reply, because I don't know how to reproduce the issue using efetch from NCBI itself. The E-utilities are available for UNIX and Mac environments, but since I was having the problem on Windows 10, I installed entrez-direct via conda on the Windows Subsystem for Linux.

    There the command returns a UTF-8:

    $ efetch -db gds -id 200079209 > encoding.txt
    $ file encoding.txt
    encoding.txt: UTF-8 Unicode text, with very long lines
    
  5. peterjc commented on Oct 11, 2017

    @peterjc
    Member

    You would ideally have sent the NCBI a tool neutral test case, to do that first you'd need the Entrez URL:

    >>> print(handle.url)
    https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?id=200079209&db=gds&tool=biopython&email=my%40email.com
    

    More generally, you can remove the tool and email and it gives a minimal working URL - note you must quote the URL to prevent bash doing magic with the ampersands:

    $ curl 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?id=200079209&db=gds'
    
    1. Airway epithelial cells from smokers with and without bronchial premalignant lesions
    (Submitter supplied) While lung cancer is the leading cause of cancer death in the US, we have a limited understanding of the earliest molecular events preceding the onset of disease. Prior work has demonstrated that cigarette smoke creates a molecular “field of injury” throughout the airway epithelium and that there are distinct alterations in the airway transcriptome among smokers who have lung cancer. Molecular characterization of this airway “field of injury” in current and former smokers with premalignant lesions (PMLs) could provide novel insights into the earliest molecular events associated with lung carcinogenesis and identify relatively accessible biomarkers to guide lung cancer detection and early intervention. more...
    Organism:	Homo sapiens
    Type:		Expression profiling by high throughput sequencing
    Platform: GPL16791 82 Samples
    FTP download: GEO (TSV) ftp://ftp.ncbi.nlm.nih.gov/geo/series/GSE79nnn/GSE79209/
    SRA Run Selector: https://www.ncbi.nlm.nih.gov/Traces/study/?acc=PRJNA315161
    Series		Accession: GSE79209	ID: 200079209
    

    If you save that, or pipe it directly though hexdump, we can examine the problem characters:

    $ curl 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?id=200079209&db=gds' > trouble.txt
    $ hexdump -C trouble.txt | head -n 24 | tail -n 4
    00000140  65 20 63 72 65 61 74 65  73 20 61 20 6d 6f 6c 65  |e creates a mole|
    00000150  63 75 6c 61 72 20 e2 80  9c 66 69 65 6c 64 20 6f  |cular ...field o|
    00000160  66 20 69 6e 6a 75 72 79  e2 80 9d 20 74 68 72 6f  |f injury... thro|
    00000170  75 67 68 6f 75 74 20 74  68 65 20 61 69 72 77 61  |ughout the airwa|
    

    You can see the opening quote of "field of injury" is three bytes in hex 0xE2 0x80 0x9C, matching Unicode Character 'LEFT DOUBLE QUOTATION MARK' (U+201C) http://www.fileformat.info/info/unicode/char/201c/index.htm

    Likewise, the closing quote in the file is three bytes 0xE2 0x80 0x9D, matching Unicode Character 'RIGHT DOUBLE QUOTATION MARK' (U+201D) http://www.fileformat.info/info/unicode/char/201d/index.htm

    This seems to be valid UTF8 (which would be a sensible encoding for the NCBI to be using even though I'm unaware they have declared this), e.g.

    $ python3
    Python 3.4.1 (default, Aug 30 2014, 09:38:58) 
    [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> example = b'molecular \xe2\x80\x9cfield of injury\xe2\x80\x9d throughout'
    >>> example.decode('utf8')
    'molecular “field of injury” throughout'
    

    So, I think the NCBI are at fault for using non-ASCI without clearly declaring an encoding, but since their data here is UTF-8 it shouldn't be a big problem.

    However, I believe the problem is in your machine locale settings. A related test:

    $ LANG=C python3
    Python 3.4.1 (default, Aug 30 2014, 09:38:58) 
    [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> example = b'molecular \xe2\x80\x9cfield of injury\xe2\x80\x9d throughout'
    >>> example.decode('utf8')
    'molecular \u201cfield of injury\u201d throughout'
    >>> print(example)
    b'molecular \xe2\x80\x9cfield of injury\xe2\x80\x9d throughout'
    >>> print(example.decode('utf8'))
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    UnicodeEncodeError: 'ascii' codec can't encode character '\u201c' in position 10: ordinal not in range(128)
    

    Returning to the data from the NCBI, on my Linux machine if I deliberately use a non-UTF8 locale it breaks:

    $ python3 -c "print(len(open('trouble.txt').read()))"
    1140
    $ LANG=C python3 -c "print(len(open('trouble.txt').read()))"
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/pc40583/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 0xe2 in position 342: ordinal not in range(128)
    

    Here my Linux machine's locale is as follows:

    $ locale
    LANG=en_GB.UTF-8
    LC_CTYPE="en_GB.UTF-8"
    LC_NUMERIC="en_GB.UTF-8"
    LC_TIME="en_GB.UTF-8"
    LC_COLLATE="en_GB.UTF-8"
    LC_MONETARY="en_GB.UTF-8"
    LC_MESSAGES="en_GB.UTF-8"
    LC_PAPER="en_GB.UTF-8"
    LC_NAME="en_GB.UTF-8"
    LC_ADDRESS="en_GB.UTF-8"
    LC_TELEPHONE="en_GB.UTF-8"
    LC_MEASUREMENT="en_GB.UTF-8"
    LC_IDENTIFICATION="en_GB.UTF-8"
    LC_ALL=
    

    What is the default locale/encoding on your machine? I'm not sure how best to find this on Windows - but perhaps the Windows Subsystem for Linux will let you run the locale command?

  6. dterg commented on Oct 24, 2017

    @dterg

    Same issue here on Win10. Locale are set as @peterjc reported.

  7. peterjc commented on Oct 24, 2017

    @peterjc
    Member

    @dterg how do you check the locale settings on Win10? And can you post that output please

  8. dterg commented on Oct 25, 2017

    @dterg

    @peterjc Assuming you have bash for windows installed (as instructed here), then you can run any linux commands; in this case locale. This is my output:

    LANG=en_US.UTF-8
    LANGUAGE=
    LC_CTYPE="en_US.UTF-8"
    LC_NUMERIC="en_US.UTF-8"
    LC_TIME="en_US.UTF-8"
    LC_COLLATE="en_US.UTF-8"
    LC_MONETARY="en_US.UTF-8"
    LC_MESSAGES="en_US.UTF-8"
    LC_PAPER="en_US.UTF-8"
    LC_NAME="en_US.UTF-8"
    LC_ADDRESS="en_US.UTF-8"
    LC_TELEPHONE="en_US.UTF-8"
    LC_MEASUREMENT="en_US.UTF-8"
    LC_IDENTIFICATION="en_US.UTF-8"
    LC_ALL=
    

    As @BioGeek reported, everything works fine with python 2.7 so I have temporarily switch to 2.7. I attempted to explicitly define the encoding to utf-8 during the url handle instanstiation but that's not possible at the moment. Maybe that could be a possible solution?

  9. peterjc commented on Oct 25, 2017

    @peterjc
    Member

    @dterg Are you running Python via bash for Windows (in which case those locale settings are probably being used), or native Windows Python (in which case the locale settings may differ)?

    Does this tell you anything useful (here running on my work Mac):

    $ python3 -c "import locale; print(locale.getdefaultlocale()); print(locale.getlocale()); print(locale.getpreferredencoding())"
    ('en_GB', 'UTF-8')
    ('en_GB', 'UTF-8')
    UTF-8
    
  10. BioGeek commented on Oct 26, 2017

    @BioGeek
    ContributorAuthor

    OK, so let's recapitulate my experiments:

    I'll show the output of

    print(locale.getdefaultlocale())
    print(locale.getlocale())
    print(locale.getpreferredencoding())
    

    and whether or not the sample script from the first post succeeded.


    Windows 7, Python 2.7.11

    ('nl_BE', 'cp1252')
    ('Dutch_Belgium, '1252')
    cp1252
    

    ✔️ script succeeded

    Windows 7, Python 3.5.1

    ('nl_BE', 'cp1252')
    ('Dutch_Belgium, '1252')
    cp1252
    

    ❌ UnicodeDecodeError

    Windows 10, Anaconda Python 3.6.3

    ('en_US', 'cp1252')
    (None, None)
    cp1252
    

    ❌ UnicodeDecodeError

    Windows 10, Linux subsystem for Windows, Anaconda Python 3.6.3

    ('en_US', 'UTF-8')
    ('en_US', 'UTF-8')
    UTF-8
    

    ✔️ script succeeded


    So it seems that the combination of Pyhon >= 3.5.1 and a locale of cp1252 causes the UnicodeDecodeError.

    Let me know if I need to run additional tests.

  11. peterjc commented on Oct 26, 2017

    @peterjc
    Member

    Great - so the answer seems to be ensure you are using a UTF-8 locale to work with NCBI data from Entrez (or stick with Python 2 which doesn't care).

    Assuming the NCBI were to officially state that Entrez returns data encoded as UTF-8, is there anything we can change in Bio.Entrez to work better on locales like cp1252 or C?

  12. dterg commented on Oct 26, 2017

    @dterg

    In my case on Windows 10, Anaconda Python 3.5.4 this is the output:
    ('en_US', 'cp1252') ('None, None) cp1252

    Checking the systems default encoding:

    import sys
    sys.getdefaultencoding()
    

    outputs utf-8

    Given that locale.getdefaultlocale() outputted cp1252, the below fixes it for me (i.e. now I can run the script on Win 10, python 3.5):

    import locale
    locale.getdefaultlocale = (lambda *args: ['en_US', 'utf8'])
    locale.getlocale = (lambda *args: ['en_US', 'utf8'])
    

    Does it fix it for you @BioGeek?

  13. dterg commented on Oct 26, 2017

    @dterg

    @peterjc Maybe an internal check on the encoding of the handle to see if its anything other than utf8 and internally set the locale to utf8 might be more user-friendly?

  14. peterjc commented on Oct 26, 2017

    @peterjc
    Member

    @dterg can you explore that idea? I do not currently have access to a Windows machine for direct testing.

    We may need to document setting the locale to UTF-8 for Python 3 Windows users.

    I also think we should follow up with the NCBI, as they should either fix the funny quotes in this example, or document what encoding they are using.

  15. BioGeek commented on Oct 26, 2017

    @BioGeek
    ContributorAuthor

    @dterg Unfortunately, your fix doesn't work for me:

    import locale
    import sys
    print(sys.getdefaultencoding())
    print(locale.getdefaultlocale()); 
    print(locale.getlocale()); 
    print(locale.getpreferredencoding())
    
    print("Monkeypatching")
    locale.getdefaultlocale = (lambda *args: ['en_US', 'utf8'])
    locale.getlocale = (lambda *args: ['en_US', 'utf8'])
    locale.getpreferredencoding = (lambda *args: 'utf8')
    
    print(sys.getdefaultencoding())
    print(locale.getdefaultlocale()); 
    print(locale.getlocale()); 
    print(locale.getpreferredencoding())
    
    from Bio import Entrez
    Entrez.email = '[email protected]'
    handle = Entrez.efetch(db="gds", id= '200079209')
    print(handle.read())
    

    prints (when run with Anaconda Python 3.6.3 on Windows 10):

    utf-8
    ('en_US', 'cp1252')
    (None, None)
    cp1252
    Monkeypatching
    utf-8
    ['en_US', 'utf8']
    ['en_US', 'utf8']
    utf8
    Traceback (most recent call last):
      File "unicode_bug.py", line 29, in <module>
        print(handle.read())
      File "C:\Users\jeroen\AppData\Local\Continuum\Anaconda3\lib\encodings\cp1252.py", line 23, in decode
        return codecs.charmap_decode(input,self.errors,decoding_table)[0]
    UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 362: character maps to <undefined>
    

    So, despite the monkeypatching, it still is going into the lib\encodings\cp1252.py file.

    I'll follow up with the NCBI to get a definite answer about the encoding they are using.

  16. BioGeek commented on Oct 26, 2017

    @BioGeek
    ContributorAuthor

    Response from NCBI:

    The picture may not be as clear cut since efetch support is NOT uniform across different databases. What your call returns is only the summary of that record. You can compare that with this esummary call to see that the description is essentially part of what esummary returns:

    https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?id=200079209&db=gds

    Note that in this format, the UTF-8 encoding is explicitly declared:

    For better tagging, you can add "&version=2.0" to the call. In which the output you described is the

    section of the esummary 2.0 output.

    Given this and your need of clarity in encoding, you may want to adjust your workflow to use esummary xml instead.

    I will need to check with the group and our system staff to see what information they can provide on the "text" output. This may take time and your patience will be appreciated.

  17. peterjc commented on Oct 26, 2017

    @peterjc
    Member

    They're right that the XML formats will often declare an encoding, as here:

    $ curl "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?id=200079209&db=gds"
    <?xml version="1.0" encoding="UTF-8" ?>
    ...
    

    The problem is the plain text output - where I appreciate that Entrez is sitting on top of a range of back end systems with different limitations. One option is they could commit to only return ASCII, but otherwise it certainly seems assuming UTF-8 from Entrez is a reasonable stance.

  18. peterjc commented on Oct 27, 2017

    @peterjc
    Member

    In pull request #1429 @BioGeek is taking advantage of the HTTP headers to see which encoding the NCBI Entrez (or other web-services) say they are using. I would still welcome a human readable statement in the Entrez help about the encoding, but this is a practical way forward.

  19. danablanc commented on Dec 17, 2017

    @danablanc

    Hi!

    I have the same problem when I invoke the read function.
    How can I deal with this issue?

    Thank you!

  20. BioGeek commented on Dec 17, 2017

    @BioGeek
    ContributorAuthor

    Hi @danablanc,

    You can manually apply these changes to the file Bio/_py3k/__init__.py.

    Can you confirm that this solves your issue?

  21. danablanc commented on Dec 17, 2017

    @danablanc

    @BioGeek thank you! My issue was solved

  22. PraxisSpace commented on Feb 15, 2018

    @PraxisSpace

    The latest commit still can result in crashes on Windows with python3.

    For example, the following URL, generated from an NCBI request, returns an xml file:

    https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=protein&id=71042798%2C157833493%2C371927696%2C157834149%2C386783435%2C390981250%2C848130061%2C99031714%2C40889881%2C835020732%2C119390124%2C308198780%2C157833610%2C161172175%2C2781023%2C47169448%2C315583375%2C294662290%2C319443304%2C700588158%2C193506632%2C330689316%2C294662288%2C550545872%2C1321390714%2C1285033580%2C700588159%2C1321390705%2C22219037%2C13399644%2C584579595%2C343197194%2C317455537%2C344189571%2C34810932%2C444302159%2C334878440%2C560189139%2C560189134%2C196049869%2C576865086%2C576865080%2C256032553%2C1942184%2C1272615640%2C157831581%2C157830096%2C806394422%2C1272615642%2C1023176681&retmode=xml&

    The XML does not indicate its encoding.

    The query for default encoding, done here, can return None without a user's preferred encoding having previously been set. With encoding=None, the call to io.TextIOWrapper(io.BufferedReader(handle), encoding=encoding) gets you back to the system's default encoding, which on windows is cp1252 which brings you back to square one.

    But regardless, the logic behind calling locale.getpreferredencoding(False) seems a little worrisome.

    The user's default encoding would seem to be irrelevant. It is only the encoding of the remote resource that matters, and there, a default of 'UTF-8' seems the safest.

    Any thoughts then on changing this line to be simply:
    encoding = 'UTF-8'

  23. peterjc commented on Feb 15, 2018

    @peterjc
    Member

    @EdwardBlakeMiller Please report to the NCBI that with db=protein and retmode=xml you are getting back an XML file which does not declare its encoding.

    But good to know that in this example too, defaulting to UTF-8 works.

  24. PraxisSpace commented on Feb 15, 2018

    @PraxisSpace

    Hi, @peterjc. Is there a submission form to use to report this to the NCBI?

  25. peterjc commented on Feb 15, 2018

    @peterjc
    Member

    I don't think there is a contact form, try the eutilities at ncbi.nlm.nih.gov address? You can CC my GoogleMail address if you like.

  26. mdehoon commented on Nov 10, 2020

    @mdehoon
    Contributor

    If I understand correctly, Entrez uses UTF-8, which with the current version of BIopython is decoded correctly in the Entrez._open function called by Entrez.efetch. The problem only happens if you try to print the resulting string to screen, as the string contains unicode characters that the terminal (depending on the locale settings) does not know how to handle. But this issue is independent of NCBI Entrez and Biopython; you would not be able to print any other string containing those unicode characters to the terminal either.
    If my understanding is correct, can we close this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions