Repository: biopython/biopython

Issue:
test_NCBIXML.py UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3
Hi all,

`test_NCBIXML.py` fails with these errors (Python-3.5.1):

`UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 313: ordinal not in range(128)`

Full log: https://kojipkgs.fedoraproject.org//work/tasks/4147/14504147/build.log

test_NCBIXML.py UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3
Hi all,

`test_NCBIXML.py` fails with these errors (Python-3.5.1):

`UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 313: ordinal not in range(128)`

Full log: https://kojipkgs.fedoraproject.org//work/tasks/4147/14504147/build.log



Discussion:
So this is on 64 bit Fedora Linux as part of trying to package Biopython 1.67 - did everything work on Biopython 1.66?

Can you reproduce this outside of the packaging setup? e.g.

```
wget http://biopython.org/DIST/biopython-1.67.tar.gz
tar -zxvf biopython-1.67.tar.gz
cd biopython-1.67
/usr/bin/python3 setup.py build
cd Tests
/usr/bin/python3 run_tests.py --offline -v test_NCBIXML.py
```

Is there anything unusual in the locale settings?

(Right now the closest I have to reproduce this is Python 3.5.0, but I'll update that to Python 3.5.1 just in case that matters)

Hi,

> So this is on 64 bit Fedora Linux as part of trying to package Biopython 1.67 - did everything work on Biopython 1.66?

Yes, with Python-3.5 .

> Can you reproduce this outside of the packaging setup?

I can't try now, I need Fedora 24 at least (it's a beta).
This error is not reproduced outside of the packaging setup on Fedora 23 with Python-3.4.

I can't reproduce this on Python 3.5.1 on CentOS 6.

My guess is something subtle to do with unicode and locales on the Fedora 24 beta - do you understand https://bugzilla.redhat.com/ enough to pull out just bugs filed against the beta?

It looks this bug on Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=1262082

Can you see what `$LANG` is set to on this problem machine? e.g.

```
echo $LANG
```

That might be enough for us to reproduce this.

> echo $LANG

en_US.UTF-8

Unfortunately that doesn't trigger the problem on my 64-bit CentOS 6 machine:

```
$ LANG=en_US.UTF-8 python3.5 run_tests.py --offline -v test_NCBIXML.py
Skipping any tests requiring internet access
Python version: 3.5.1 (default, Jun 15 2016, 17:47:04) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-16)]
Operating system: posix linux
test_NCBIXML ... ok
test_xml_2212L_blastn_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTN 2.2.12, gi|1348916|gb|G26684.1|G26684 (xml_2212L_blastn_001) ... ok
test_xml_2212L_blastp_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.12, gi|49176427|ref|NP_418280.3| (xml_2212L_blastp_001) ... ok
test_xml_2212L_blastx_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTX 2.2.12, gi|1347369|gb|G25137.1|G25137 (xml_2212L_blastx_001) ... ok
test_xml_2212L_tblastn_001 (test_NCBIXML.TestNCBIXML)
Parsing TBLASTN 2.2.12, gi|729325|sp|P39483|DHG2_BACME (xml_2212L_tblastn_001) ... ok
test_xml_2212L_tblastx_001 (test_NCBIXML.TestNCBIXML)
Parsing TBLASTX 2.2.12, gi|1348853|gb|G26621.1|G26621, BLOSUM80 (xml_2212L_tblastx_001) ... ok
test_xml_2218L_blastp_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.18, Fake query (xml_2218L_blastp_001) ... ok
test_xml_2218L_rpsblast_001 (test_NCBIXML.TestNCBIXML)
Parsing PSI-BLASTP 2.2.18, single query which converges in 3 iterations (xml_2218L_rpsblast_001) ... ok
test_xml_2218_blastp_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.18+, gi|160837788|ref|NP_075631.2| (xml_2218_blastp_001) ... ok
test_xml_2218_blastp_002 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.18+, SwissProt Q08386 and P07175, no hits (xml_2218_blastp_002) ... ok
test_xml_2222_blastp_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.22+, multiple queries against NR (xml_2222_blastp_001) ... ok
test_xml_2222_blastx_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTX 2.2.22+, multiple queries against NR (xml_2222_blastx_001) ... ok
----------------------------------------------------------------------
Ran 1 test in 0.469 seconds
```

This machine's original setting:

```
$ echo $LANG
en_GB.UTF-8
```

However, deliberately using `LANG=C` seems to reproduce the exception you reported:

```
$ LANG=C python3.5 run_tests.py --offline -v test_NCBIXML.py
Skipping any tests requiring internet access
Python version: 3.5.1 (default, Jun 15 2016, 17:47:04) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-16)]
Operating system: posix linux
test_NCBIXML ... FAIL
test_xml_2212L_blastn_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTN 2.2.12, gi|1348916|gb|G26684.1|G26684 (xml_2212L_blastn_001) ... ERROR
test_xml_2212L_blastp_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.12, gi|49176427|ref|NP_418280.3| (xml_2212L_blastp_001) ... ERROR
test_xml_2212L_blastx_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTX 2.2.12, gi|1347369|gb|G25137.1|G25137 (xml_2212L_blastx_001) ... ERROR
test_xml_2212L_tblastn_001 (test_NCBIXML.TestNCBIXML)
Parsing TBLASTN 2.2.12, gi|729325|sp|P39483|DHG2_BACME (xml_2212L_tblastn_001) ... ERROR
test_xml_2212L_tblastx_001 (test_NCBIXML.TestNCBIXML)
Parsing TBLASTX 2.2.12, gi|1348853|gb|G26621.1|G26621, BLOSUM80 (xml_2212L_tblastx_001) ... ERROR
test_xml_2218L_blastp_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.18, Fake query (xml_2218L_blastp_001) ... ok
test_xml_2218L_rpsblast_001 (test_NCBIXML.TestNCBIXML)
Parsing PSI-BLASTP 2.2.18, single query which converges in 3 iterations (xml_2218L_rpsblast_001) ... ok
test_xml_2218_blastp_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.18+, gi|160837788|ref|NP_075631.2| (xml_2218_blastp_001) ... ERROR
test_xml_2218_blastp_002 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.18+, SwissProt Q08386 and P07175, no hits (xml_2218_blastp_002) ... ERROR
test_xml_2222_blastp_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.22+, multiple queries against NR (xml_2222_blastp_001) ... ok
test_xml_2222_blastx_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTX 2.2.22+, multiple queries against NR (xml_2222_blastx_001) ... ok

======================================================================
ERROR: test_xml_2212L_blastn_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTN 2.2.12, gi|1348916|gb|G26684.1|G26684 (xml_2212L_blastn_001)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home_local/buildslave/repositories/biopython/Tests/test_NCBIXML.py", line 1407, in test_xml_2212L_blastn_001
    record = next(records)
  File "/home_local/buildslave/repositories/biopython/build/lib.linux-x86_64-3.5/Bio/Blast/NCBIXML.py", line 570, in parse
    text = handle.read(BLOCK)
  File "/home_local/buildslave/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 331: ordinal not in range(128)

======================================================================
ERROR: test_xml_2212L_blastp_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.12, gi|49176427|ref|NP_418280.3| (xml_2212L_blastp_001)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home_local/buildslave/repositories/biopython/Tests/test_NCBIXML.py", line 22, in test_xml_2212L_blastp_001
    record = next(records)
  File "/home_local/buildslave/repositories/biopython/build/lib.linux-x86_64-3.5/Bio/Blast/NCBIXML.py", line 570, in parse
    text = handle.read(BLOCK)
  File "/home_local/buildslave/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 331: ordinal not in range(128)

======================================================================
ERROR: test_xml_2212L_blastx_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTX 2.2.12, gi|1347369|gb|G25137.1|G25137 (xml_2212L_blastx_001)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home_local/buildslave/repositories/biopython/Tests/test_NCBIXML.py", line 1437, in test_xml_2212L_blastx_001
    record = next(records)
  File "/home_local/buildslave/repositories/biopython/build/lib.linux-x86_64-3.5/Bio/Blast/NCBIXML.py", line 570, in parse
    text = handle.read(BLOCK)
  File "/home_local/buildslave/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 331: ordinal not in range(128)

======================================================================
ERROR: test_xml_2212L_tblastn_001 (test_NCBIXML.TestNCBIXML)
Parsing TBLASTN 2.2.12, gi|729325|sp|P39483|DHG2_BACME (xml_2212L_tblastn_001)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home_local/buildslave/repositories/biopython/Tests/test_NCBIXML.py", line 1457, in test_xml_2212L_tblastn_001
    record = next(records)
  File "/home_local/buildslave/repositories/biopython/build/lib.linux-x86_64-3.5/Bio/Blast/NCBIXML.py", line 570, in parse
    text = handle.read(BLOCK)
  File "/home_local/buildslave/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 333: ordinal not in range(128)

======================================================================
ERROR: test_xml_2212L_tblastx_001 (test_NCBIXML.TestNCBIXML)
Parsing TBLASTX 2.2.12, gi|1348853|gb|G26621.1|G26621, BLOSUM80 (xml_2212L_tblastx_001)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home_local/buildslave/repositories/biopython/Tests/test_NCBIXML.py", line 1477, in test_xml_2212L_tblastx_001
    record = next(records)
  File "/home_local/buildslave/repositories/biopython/build/lib.linux-x86_64-3.5/Bio/Blast/NCBIXML.py", line 570, in parse
    text = handle.read(BLOCK)
  File "/home_local/buildslave/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 333: ordinal not in range(128)

======================================================================
ERROR: test_xml_2218_blastp_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.18+, gi|160837788|ref|NP_075631.2| (xml_2218_blastp_001)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home_local/buildslave/repositories/biopython/Tests/test_NCBIXML.py", line 1499, in test_xml_2218_blastp_001
    record = next(records)
  File "/home_local/buildslave/repositories/biopython/build/lib.linux-x86_64-3.5/Bio/Blast/NCBIXML.py", line 570, in parse
    text = handle.read(BLOCK)
  File "/home_local/buildslave/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 313: ordinal not in range(128)

======================================================================
ERROR: test_xml_2218_blastp_002 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.18+, SwissProt Q08386 and P07175, no hits (xml_2218_blastp_002)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home_local/buildslave/repositories/biopython/Tests/test_NCBIXML.py", line 1563, in test_xml_2218_blastp_002
    record = next(records)
  File "/home_local/buildslave/repositories/biopython/build/lib.linux-x86_64-3.5/Bio/Blast/NCBIXML.py", line 570, in parse
    text = handle.read(BLOCK)
  File "/home_local/buildslave/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 313: ordinal not in range(128)

----------------------------------------------------------------------
Ran 1 test in 0.151 seconds

FAILED (failures = 1)
```

I suspect the problematic data is `Alejandro A. Schäffer`, one of the BLAST authors listed in some of the XML output as:

```
<BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (
1997), &quot;Gapped BLAST and PSI-BLAST: a new generation of protein database search programs&quot;, Nucleic Acids Res. 25:3389-3402.</BlastOutput_ref
erence>
```

This occurs in all the test files where `LANG=C` makes the test fail (and I think ONLY those files):

```
$ grep Alejandro xml_2212L_blastn_001.xml xml_2212L_blastp_001.xml xml_2212L_blastx_001.xml xml_2212L_tblastn_001.xml xml_2212L_tblastx_001.xml xml_2218_blastp_001.xml xml_2218_blastp_002.xml 
xml_2212L_blastn_001.xml:  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), &quot;Gapped BLAST and PSI-BLAST: a new generation of protein database search programs&quot;, Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
xml_2212L_blastp_001.xml:  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), &quot;Gapped BLAST and PSI-BLAST: a new generation of protein database search programs&quot;, Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
xml_2212L_blastx_001.xml:  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), &quot;Gapped BLAST and PSI-BLAST: a new generation of protein database search programs&quot;, Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
xml_2212L_tblastn_001.xml:  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), &quot;Gapped BLAST and PSI-BLAST: a new generation of protein database search programs&quot;, Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
xml_2212L_tblastx_001.xml:  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), &quot;Gapped BLAST and PSI-BLAST: a new generation of protein database search programs&quot;, Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
xml_2218_blastp_001.xml:  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), &quot;Gapped BLAST and PSI-BLAST: a new generation of protein database search programs&quot;, Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
xml_2218_blastp_002.xml:  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), "Gapped BLAST and PSI-BLAST: a new generation of protein database search programs", Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
```

The reference formatting looks like something the NCBI have tweaked with different version of the legacy BLAST tool, and its replacement BLAST+. Also which reference is given will depend on the tool/algorithm used.

Interestingly in some of the BLAST XML files this appears as:

```
<BlastOutput_reference>Stephen F. Altschul, Thomas L. Madden, Alejandro A. Sch&amp;auml;ffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), &quot;Gapped BLAST and PSI-BLAST: a new generation of protein database search programs&quot;, Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
```

Here the `&auml;` is being used (double escaped) of the lower-case a with dots over it.

It seems the NCBI have never used an explicit encoding in their XML output files, e.g. nothing like this:

```
<?xml version="1.0" encoding="UTF-8"?>
```

Once we come to process the reference text, the exact encoding is clearly important here, note:

```
$ python3.5 -c "print('Schäffer'.encode('UTF-8'))"
b'Sch\xc3\xa4ffer'
$ python3.5 -c "print('Schäffer'.encode('latin-1'))"
b'Sch\xe4ffer'
```

I'm a little confused about byte character `0xc3` (not used in the latin-1 encoding), but that does seem to match the exception we're seeing.

Regarding this:

```
$ python3.5 -c "print('Schäffer'.encode('UTF-8'))"
b'Sch\xc3\xa4ffer'
$ python3.5 -c "print('Schäffer'.encode('latin-1'))"
b'Sch\xe4ffer'
```

Looking at the raw file,

```
$ hexdump -C xml_2218_blastp_002.xml | head -n 20
00000000  3c 3f 78 6d 6c 20 76 65  72 73 69 6f 6e 3d 22 31  |<?xml version="1|
00000010  2e 30 22 3f 3e 0a 3c 21  44 4f 43 54 59 50 45 20  |.0"?>.<!DOCTYPE |
00000020  42 6c 61 73 74 4f 75 74  70 75 74 20 50 55 42 4c  |BlastOutput PUBL|
00000030  49 43 20 22 2d 2f 2f 4e  43 42 49 2f 2f 4e 43 42  |IC "-//NCBI//NCB|
00000040  49 20 42 6c 61 73 74 4f  75 74 70 75 74 2f 45 4e  |I BlastOutput/EN|
00000050  22 20 22 4e 43 42 49 5f  42 6c 61 73 74 4f 75 74  |" "NCBI_BlastOut|
00000060  70 75 74 2e 64 74 64 22  3e 0a 3c 42 6c 61 73 74  |put.dtd">.<Blast|
00000070  4f 75 74 70 75 74 3e 0a  20 20 3c 42 6c 61 73 74  |Output>.  <Blast|
00000080  4f 75 74 70 75 74 5f 70  72 6f 67 72 61 6d 3e 62  |Output_program>b|
00000090  6c 61 73 74 70 3c 2f 42  6c 61 73 74 4f 75 74 70  |lastp</BlastOutp|
000000a0  75 74 5f 70 72 6f 67 72  61 6d 3e 0a 20 20 3c 42  |ut_program>.  <B|
000000b0  6c 61 73 74 4f 75 74 70  75 74 5f 76 65 72 73 69  |lastOutput_versi|
000000c0  6f 6e 3e 42 4c 41 53 54  50 20 32 2e 32 2e 31 38  |on>BLASTP 2.2.18|
000000d0  2b 3c 2f 42 6c 61 73 74  4f 75 74 70 75 74 5f 76  |+</BlastOutput_v|
000000e0  65 72 73 69 6f 6e 3e 0a  20 20 3c 42 6c 61 73 74  |ersion>.  <Blast|
000000f0  4f 75 74 70 75 74 5f 72  65 66 65 72 65 6e 63 65  |Output_reference|
00000100  3e 41 6c 74 73 63 68 75  6c 2c 20 53 74 65 70 68  |>Altschul, Steph|
00000110  65 6e 20 46 2e 2c 20 54  68 6f 6d 61 73 20 4c 2e  |en F., Thomas L.|
00000120  20 4d 61 64 64 65 6e 2c  20 41 6c 65 6a 61 6e 64  | Madden, Alejand|
00000130  72 6f 20 41 2e 20 53 63  68 c3 a4 66 66 65 72 2c  |ro A. Sch..ffer,|
```

This is clearly consistent with the `b'Sch\xc3\xa4ffer'` form (0xC3 0xA4), which suggests UTF-8 encoding rather than latin-1.

Minimal test case:

```
$ cd Tests/Blast
$ LANG=en_US.UTF-8 python3.5 -c "h = open('xml_2218_blastp_002.xml'); print(h.read(400))"
<?xml version="1.0"?>
<!DOCTYPE BlastOutput PUBLIC "-//NCBI//NCBI BlastOutput/EN" "NCBI_BlastOutput.dtd">
<BlastOutput>
  <BlastOutput_program>blastp</BlastOutput_program>
  <BlastOutput_version>BLASTP 2.2.18+</BlastOutput_version>
  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), "Gapped BLA
$ LANG=C python3.5 -c "h = open('xml_2218_blastp_002.xml'); print(h.read(400))"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home_local/buildslave/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 313: ordinal not in range(128)
```

I presume with `LANG=C` the default encoding breaks, so we need to set UTF-8 explicitly for BLAST XML files? See also https://pythonhosted.org/kitchen/unicode-frustrations.html

Could you try specifying the encoding directly?

``` bash
LANG=C python3.5 -c "h = open('xml_2218_blastp_002.xml', encoding='utf-8'); print(h.read(400))"
```

`LANG=C` doesn't do anything on my machine, so I can't reproduce the error and test this myself.

Details about my setup:
➜  Blast git:(master) python -c "import Bio; print(Bio.__version__)"
1.66
➜  Blast git:(master) python --version
Python 3.5.1 :: Anaconda 2.4.0 (x86_64)
➜  Blast git:(master) uname -a
Darwin jackfruit.local 15.5.0 Darwin Kernel Version 15.5.0: Tue Apr 19 18:36:36 PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64

@smsaladi sadly no joy with the explicit encoding in the open call, Linux 64:

```
$ LANG=en_US.UTF-8 python3.5 -c "h = open('xml_2218_blastp_002.xml', encoding='utf-8'); print(h.read(400))"
<?xml version="1.0"?>
<!DOCTYPE BlastOutput PUBLIC "-//NCBI//NCBI BlastOutput/EN" "NCBI_BlastOutput.dtd">
<BlastOutput>
  <BlastOutput_program>blastp</BlastOutput_program>
  <BlastOutput_version>BLASTP 2.2.18+</BlastOutput_version>
  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), "Gapped BLA
$ LANG=C python3.5 -c "h = open('xml_2218_blastp_002.xml', encoding='utf-8'); print(h.read(400))"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character '\xe4' in position 313: ordinal not in range(128)
```

Interestingly I _can_ reproduce this on Mac OS X, using a self-compiled Python 3.3.3rc1, Python 3.4.4 or Python 3.5.0,

```
peter-cocks-mac-pro:Blast pjcock$ LANG=en_US.UTF-8 python3.5 -c "h = open('xml_2218_blastp_002.xml'); print(h.read(400))"
<?xml version="1.0"?>
<!DOCTYPE BlastOutput PUBLIC "-//NCBI//NCBI BlastOutput/EN" "NCBI_BlastOutput.dtd">
<BlastOutput>
  <BlastOutput_program>blastp</BlastOutput_program>
  <BlastOutput_version>BLASTP 2.2.18+</BlastOutput_version>
  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), "Gapped BLA
peter-cocks-mac-pro:Blast pjcock$ LANG=C python3.5 -c "h = open('xml_2218_blastp_002.xml'); print(h.read(400))"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/pjcock/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 313: ordinal not in range(128)
peter-cocks-mac-pro:Blast pjcock$ LANG=C python3.5 -c "h = open('xml_2218_blastp_002.xml', encoding='utf-8'); print(h.read(400))"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character '\xe4' in position 313: ordinal not in range(128)
```

It looks like the key difference between our Mac setups is the way Python 3 was installed (mine are compiled from source using `--prefix=$HOME` and breaks, yours is from Anaconda and works).

```
peter-cocks-mac-pro:Blast pjcock$ python3.5 --version
Python 3.5.0
$ uname -a
Darwin peter-cocks-mac-pro.local 15.5.0 Darwin Kernel Version 15.5.0: Tue Apr 19 18:36:36 PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64
```

Seeing this again during work to build wheels for Biopython 1.70 under TravisCI (using a quite different setup to our TravisCI continuous integration tests),

e.g. https://travis-ci.org/biopython/biopython-wheels/jobs/252754295

This also affects other tests too:

```
======================================================================
ERROR: test_xml_2212L_blastn_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTN 2.2.12, gi|1348916|gb|G26684.1|G26684 (xml_2212L_blastn_001)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_NCBIXML.py", line 1407, in test_xml_2212L_blastn_001
    record = next(records)
  File "/io/biopython/Bio/Blast/NCBIXML.py", line 583, in parse
    text = handle.read(BLOCK)
  File "/venv/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 0xc3 in position 331: ordinal not in range(128)
======================================================================
ERROR: test_xml_2212L_blastp_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.12, gi|49176427|ref|NP_418280.3| (xml_2212L_blastp_001)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_NCBIXML.py", line 22, in test_xml_2212L_blastp_001
    record = next(records)
  File "/io/biopython/Bio/Blast/NCBIXML.py", line 583, in parse
    text = handle.read(BLOCK)
  File "/venv/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 0xc3 in position 331: ordinal not in range(128)
======================================================================
ERROR: test_xml_2212L_blastx_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTX 2.2.12, gi|1347369|gb|G25137.1|G25137 (xml_2212L_blastx_001)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_NCBIXML.py", line 1437, in test_xml_2212L_blastx_001
    record = next(records)
  File "/io/biopython/Bio/Blast/NCBIXML.py", line 583, in parse
    text = handle.read(BLOCK)
  File "/venv/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 0xc3 in position 331: ordinal not in range(128)
======================================================================
ERROR: test_xml_2212L_tblastn_001 (test_NCBIXML.TestNCBIXML)
Parsing TBLASTN 2.2.12, gi|729325|sp|P39483|DHG2_BACME (xml_2212L_tblastn_001)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_NCBIXML.py", line 1457, in test_xml_2212L_tblastn_001
    record = next(records)
  File "/io/biopython/Bio/Blast/NCBIXML.py", line 583, in parse
    text = handle.read(BLOCK)
  File "/venv/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 0xc3 in position 333: ordinal not in range(128)
======================================================================
ERROR: test_xml_2212L_tblastx_001 (test_NCBIXML.TestNCBIXML)
Parsing TBLASTX 2.2.12, gi|1348853|gb|G26621.1|G26621, BLOSUM80 (xml_2212L_tblastx_001)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_NCBIXML.py", line 1477, in test_xml_2212L_tblastx_001
    record = next(records)
  File "/io/biopython/Bio/Blast/NCBIXML.py", line 583, in parse
    text = handle.read(BLOCK)
  File "/venv/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 0xc3 in position 333: ordinal not in range(128)
======================================================================
ERROR: test_xml_2218_blastp_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.18+, gi|160837788|ref|NP_075631.2| (xml_2218_blastp_001)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_NCBIXML.py", line 1499, in test_xml_2218_blastp_001
    record = next(records)
  File "/io/biopython/Bio/Blast/NCBIXML.py", line 583, in parse
    text = handle.read(BLOCK)
  File "/venv/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 0xc3 in position 313: ordinal not in range(128)
======================================================================
ERROR: test_xml_2218_blastp_002 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.18+, SwissProt Q08386 and P07175, no hits (xml_2218_blastp_002)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_NCBIXML.py", line 1563, in test_xml_2218_blastp_002
    record = next(records)
  File "/io/biopython/Bio/Blast/NCBIXML.py", line 583, in parse
    text = handle.read(BLOCK)
  File "/venv/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 0xc3 in position 313: ordinal not in range(128)
======================================================================
ERROR: test_trees_and_taxa_block (test_Nexus.OldSelfTests)
Basic tree file with TREES and TAXA block
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Nexus.py", line 32, in test_trees_and_taxa_block
    nexus1.read('Nexus/bats.nex')
  File "/io/biopython/Bio/Nexus/Nexus.py", line 635, in read
    file_contents = fp.read()
  File "/venv/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 0xc3 in position 398: ordinal not in range(128)
======================================================================
ERROR: test_convert_phyloxml_binary (test_Phylo.IOTests)
Try writing phyloxml to a binary handle; fail on Py3.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 157, in test_convert_phyloxml_binary
    trees, out_handle, "phyloxml")
  File "/usr/lib/python3.4/unittest/case.py", line 704, in assertRaises
    return context.handle('assertRaises', callableObj, args, kwargs)
  File "/usr/lib/python3.4/unittest/case.py", line 162, in handle
    callable_obj(*args, **kwargs)
  File "/io/biopython/Bio/Phylo/_io.py", line 81, in write
    n = getattr(supported_formats[format], 'write')(trees, fp, **kwargs)
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 134, in write
    return Writer(obj).write(file, encoding=encoding, indent=indent)
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 678, in __init__
    self._tree = ElementTree.ElementTree(self.phyloxml(phyloxml))
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 690, in phyloxml
    for tree in obj.phylogenies:
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 130, in <genexpr>
    obj = PX.Phyloxml({}, phylogenies=(fix_single(t) for t in obj))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_convert_phyloxml_filename (test_Phylo.IOTests)
Write phyloxml to a given filename.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 170, in test_convert_phyloxml_filename
    count = Phylo.write(trees, tmp_filename, "phyloxml")
  File "/io/biopython/Bio/Phylo/_io.py", line 81, in write
    n = getattr(supported_formats[format], 'write')(trees, fp, **kwargs)
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 134, in write
    return Writer(obj).write(file, encoding=encoding, indent=indent)
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 678, in __init__
    self._tree = ElementTree.ElementTree(self.phyloxml(phyloxml))
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 690, in phyloxml
    for tree in obj.phylogenies:
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 130, in <genexpr>
    obj = PX.Phyloxml({}, phylogenies=(fix_single(t) for t in obj))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_convert_phyloxml_text (test_Phylo.IOTests)
Write phyloxml to a text handle.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 163, in test_convert_phyloxml_text
    count = Phylo.write(trees, out_handle, "phyloxml")
  File "/io/biopython/Bio/Phylo/_io.py", line 81, in write
    n = getattr(supported_formats[format], 'write')(trees, fp, **kwargs)
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 134, in write
    return Writer(obj).write(file, encoding=encoding, indent=indent)
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 678, in __init__
    self._tree = ElementTree.ElementTree(self.phyloxml(phyloxml))
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 690, in phyloxml
    for tree in obj.phylogenies:
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 130, in <genexpr>
    obj = PX.Phyloxml({}, phylogenies=(fix_single(t) for t in obj))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_newick_read_single3 (test_Phylo.IOTests)
Read Nexus file with one tree.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 53, in test_newick_read_single3
    tree = Phylo.read(EX_NEXUS2, 'nexus')
  File "/io/biopython/Bio/Phylo/_io.py", line 63, in read
    tree = next(tree_gen)
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/NexusIO.py", line 38, in parse
    nex = Nexus.Nexus(handle)
  File "/io/biopython/Bio/Nexus/Nexus.py", line 614, in __init__
    self.read(input)
  File "/io/biopython/Bio/Nexus/Nexus.py", line 635, in read
    file_contents = fp.read()
  File "/venv/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 0xc3 in position 398: ordinal not in range(128)
======================================================================
ERROR: test_collapse (test_Phylo.MixinTests)
TreeMixin: collapse() method.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
    self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_collapse_all (test_Phylo.MixinTests)
TreeMixin: collapse_all() method.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
    self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_common_ancestor (test_Phylo.MixinTests)
TreeMixin: common_ancestor() method.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
    self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_depths (test_Phylo.MixinTests)
TreeMixin: depths() method.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
    self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_distance (test_Phylo.MixinTests)
TreeMixin: distance() method.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
    self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_find_clades (test_Phylo.MixinTests)
TreeMixin: find_clades() method.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
    self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_find_elements (test_Phylo.MixinTests)
TreeMixin: find_elements() method.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
    self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_find_terminal (test_Phylo.MixinTests)
TreeMixin: find_elements() with terminal argument.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
    self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_get_path (test_Phylo.MixinTests)
TreeMixin: get_path() method.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
    self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_is_bifurcating (test_Phylo.MixinTests)
TreeMixin: is_bifurcating() method.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
    self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_is_monophyletic (test_Phylo.MixinTests)
TreeMixin: is_monophyletic() method.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
    self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_ladderize (test_Phylo.MixinTests)
TreeMixin: ladderize() method.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
    self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_prune (test_Phylo.MixinTests)
TreeMixin: prune() method.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
    self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_split (test_Phylo.MixinTests)
TreeMixin: split() method.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
    self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_total_branch_length (test_Phylo.MixinTests)
TreeMixin: total_branch_length() method.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
    self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_trace (test_Phylo.MixinTests)
TreeMixin: trace() method.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
    self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_str (test_Phylo.TreeTests)
Tree.__str__: pretty-print to a string.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 257, in test_str
    tree = Phylo.read(source, 'phyloxml')
  File "/io/biopython/Bio/Phylo/_io.py", line 63, in read
    tree = next(tree_gen)
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 1041: ordinal not in range(128)
======================================================================
ERROR: test_phylo (test_PhyloXML.WriterTests)
Round-trip parsing and serialization of phyloxml_examples.xml.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_PhyloXML.py", line 578, in test_phylo
    'test_Taxonomy', 'test_Uri',
  File "/io/biopython/Tests/test_PhyloXML.py", line 511, in _rewrite_and_call
    phx = PhyloXMLIO.read(infile)
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 86, in read
    return Parser(file).read()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_SeqIO
----------------------------------------------------------------------
Traceback (most recent call last):
  File "run_tests.py", line 439, in runTest
    suite = loader.loadTestsFromName(name)
  File "/usr/lib/python3.4/unittest/loader.py", line 105, in loadTestsFromName
    module = __import__('.'.join(parts_copy))
  File "/io/biopython/Tests/test_SeqIO.py", line 477, in <module>
    records = list(SeqIO.parse(handle=h, format=t_format))
  File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
    for r in i:
  File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
    for event, node in self._events:
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
    rc = self.getEvent()
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
    buf = self.stream.read(self.bufsize)
  File "/venv/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 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_duplicated_dbxref (test_SeqIO_SeqXML.TestDetailedRead)
Read multiple cross references to a single source
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 50, in setUp
    self.records[key] = list(SeqIO.parse(test_files[key][0], "seqxml"))
  File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
    for r in i:
  File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
    for event, node in self._events:
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
    rc = self.getEvent()
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
    buf = self.stream.read(self.bufsize)
  File "/venv/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 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_duplicated_property (test_SeqIO_SeqXML.TestDetailedRead)
Read property with multiple values
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 50, in setUp
    self.records[key] = list(SeqIO.parse(test_files[key][0], "seqxml"))
  File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
    for r in i:
  File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
    for event, node in self._events:
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
    rc = self.getEvent()
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
    buf = self.stream.read(self.bufsize)
  File "/venv/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 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_empty_description (test_SeqIO_SeqXML.TestDetailedRead)
Check empty description.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 50, in setUp
    self.records[key] = list(SeqIO.parse(test_files[key][0], "seqxml"))
  File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
    for r in i:
  File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
    for event, node in self._events:
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
    rc = self.getEvent()
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
    buf = self.stream.read(self.bufsize)
  File "/venv/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 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_full_characters_set_read (test_SeqIO_SeqXML.TestDetailedRead)
Read full characters set for each type
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 50, in setUp
    self.records[key] = list(SeqIO.parse(test_files[key][0], "seqxml"))
  File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
    for r in i:
  File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
    for event, node in self._events:
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
    rc = self.getEvent()
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
    buf = self.stream.read(self.bufsize)
  File "/venv/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 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_global_species (test_SeqIO_SeqXML.TestDetailedRead)
Check global species.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 50, in setUp
    self.records[key] = list(SeqIO.parse(test_files[key][0], "seqxml"))
  File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
    for r in i:
  File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
    for event, node in self._events:
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
    rc = self.getEvent()
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
    buf = self.stream.read(self.bufsize)
  File "/venv/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 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_local_source_definition (test_SeqIO_SeqXML.TestDetailedRead)
Check local source.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 50, in setUp
    self.records[key] = list(SeqIO.parse(test_files[key][0], "seqxml"))
  File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
    for r in i:
  File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
    for event, node in self._events:
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
    rc = self.getEvent()
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
    buf = self.stream.read(self.bufsize)
  File "/venv/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 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_local_species (test_SeqIO_SeqXML.TestDetailedRead)
Check local species.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 50, in setUp
    self.records[key] = list(SeqIO.parse(test_files[key][0], "seqxml"))
  File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
    for r in i:
  File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
    for event, node in self._events:
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
    rc = self.getEvent()
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
    buf = self.stream.read(self.bufsize)
  File "/venv/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 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_read_minimal_required (test_SeqIO_SeqXML.TestDetailedRead)
Check minimal record.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 50, in setUp
    self.records[key] = list(SeqIO.parse(test_files[key][0], "seqxml"))
  File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
    for r in i:
  File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
    for event, node in self._events:
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
    rc = self.getEvent()
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
    buf = self.stream.read(self.bufsize)
  File "/venv/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 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_special_characters_desc (test_SeqIO_SeqXML.TestDetailedRead)
Read special XML characters in description.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 50, in setUp
    self.records[key] = list(SeqIO.parse(test_files[key][0], "seqxml"))
  File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
    for r in i:
  File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
    for event, node in self._events:
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
    rc = self.getEvent()
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
    buf = self.stream.read(self.bufsize)
  File "/venv/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 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_unicode_characters_desc (test_SeqIO_SeqXML.TestDetailedRead)
Test special unicode characters in the description.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 50, in setUp
    self.records[key] = list(SeqIO.parse(test_files[key][0], "seqxml"))
  File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
    for r in i:
  File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
    for event, node in self._events:
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
    rc = self.getEvent()
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
    buf = self.stream.read(self.bufsize)
  File "/venv/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 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_read_write_rna (test_SeqIO_SeqXML.TestReadAndWrite)
Read and write RNA.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 115, in test_read_write_rna
    read1_records = list(SeqIO.parse(test_files["rna"][0], "seqxml"))
  File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
    for r in i:
  File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
    for event, node in self._events:
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
    rc = self.getEvent()
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
    buf = self.stream.read(self.bufsize)
  File "/venv/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 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_check_SeqIO (test_SeqIO_SeqXML.TestSimpleRead)
Files readable using parser via SeqIO.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 40, in test_check_SeqIO
    records = list(SeqIO.parse(test_files[key][0], "seqxml"))
  File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
    for r in i:
  File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
    for event, node in self._events:
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
    rc = self.getEvent()
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
    buf = self.stream.read(self.bufsize)
  File "/venv/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 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_doctests (test_Tutorial.TutorialTestCase)
Run tutorial doctests.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Tutorial.py", line 256, in test_doctests
    (len(failures), ", ".join(failures)))
ValueError: 1 Tutorial doctests failed: test_chapter_phylo_line_00074
----------------------------------------------------------------------
Ran 273 tests in 86.588 seconds
FAILED (failures = 7)
```

*Update*: I later added locale reporting to these builds:

```
$ locale
LANG=
LANGUAGE=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=
```
For my reference, how to find some of the problem entries with grep tested on Mac OS X.

We have example files with the composed Unicode form (NFC), e.g. for the a-with-umlaut:

```bash
$ grep $'\xc3\xa4' */*.xml
Blast/xml_2212L_blastn_001.xml:  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), &quot;Gapped BLAST and PSI-BLAST: a new generation of protein database search programs&quot;, Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
Blast/xml_2212L_blastp_001.xml:  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), &quot;Gapped BLAST and PSI-BLAST: a new generation of protein database search programs&quot;, Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
Blast/xml_2212L_blastx_001.xml:  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), &quot;Gapped BLAST and PSI-BLAST: a new generation of protein database search programs&quot;, Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
Blast/xml_2212L_tblastn_001.xml:  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), &quot;Gapped BLAST and PSI-BLAST: a new generation of protein database search programs&quot;, Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
Blast/xml_2212L_tblastx_001.xml:  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), &quot;Gapped BLAST and PSI-BLAST: a new generation of protein database search programs&quot;, Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
Blast/xml_2218_blastp_001.xml:  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), &quot;Gapped BLAST and PSI-BLAST: a new generation of protein database search programs&quot;, Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
Blast/xml_2218_blastp_002.xml:  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), "Gapped BLAST and PSI-BLAST: a new generation of protein database search programs", Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
SeqXML/rna_example.xml:        <description>åÅüöÖßøä¢£$€香肠</description>
```

e.g. for the u-with-umlaut:

``` bash
$ echo $'\xc3\xbc'
ü
$ grep $'\xc3\xbc' */*.xml
PhyloXML/distribution.xml:            <desc>ETH Zürich</desc>
PhyloXML/phyloxml_examples.xml:                  <desc>ETH Zürich</desc>
SeqXML/rna_example.xml:        <description>åÅüöÖßøä¢£$€香肠</description>
```

We do not have to worry about the decomposed Unicode form (NFD), used by the Mac OS file system, which we can get using:

```bash
$ echo -n $'\xc3\xa4' | iconv -t UTF8-MAC | hexdump -C
00000000  61 cc 88                                          |a..|
00000003
$ echo $'a\xcc\x88'
ä
$ grep $'a\xcc\x88' */*.xml
```

And for the ``u`` and umlaut diacritical character in decomposed form:
 
```
$ echo -n $'\xc3\xbc' | iconv -t UTF8-MAC | hexdump -C
00000000  75 cc 88                                          |u..|
00000003
$ echo $'u\xcc\x88'
ü
$ grep $'u\xcc\x88' */*.xml
```
Looking at this with fresh eyes, @smsaladi was right about using the encoding argument to open (under Python 3), I was tricked because with that fix the print can fail with the default locale.

On Mac OS, with my default locale or explicitly using USA settings, things work:

```
$ LANG=en_US.UTF-8 python3.6 -c "h = open('xml_2218_blastp_002.xml', encoding='utf-8'); l=h.read(400); print(l)"
<?xml version="1.0"?>
<!DOCTYPE BlastOutput PUBLIC "-//NCBI//NCBI BlastOutput/EN" "NCBI_BlastOutput.dtd">
<BlastOutput>
  <BlastOutput_program>blastp</BlastOutput_program>
  <BlastOutput_version>BLASTP 2.2.18+</BlastOutput_version>
  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), "Gapped BLA
```

However, forcibly using ``LANG=C`` so that the default encoding is just ``ascii``, the read fails:

```
$ LANG=C python3.6 -c "h = open('xml_2218_blastp_002.xml'); l=h.read(400)"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/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 313: ordinal not in range(128)
```

Adding the open argument that works:

```
$ LANG=C python3.6 -c "h = open('xml_2218_blastp_002.xml', encoding='utf-8'); l=h.read(400)"
```

But putting the print in breaks things again:

```
$ LANG=C python3.6 -c "h = open('xml_2218_blastp_002.xml', encoding='utf-8'); l=h.read(400); print(l)"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character '\xe4' in position 313: ordinal not in range(128)
```

So, yes, we should look at opening BLAST XML files (etc?) with a default encoding - but fixing that is likely to expose problems elsewhere in the tests (like the print statement in this trivial test case).

We will probably have to define our own function ``open_with_encoding`` or similar in our Python 2/3 compatibility layer ``Bio._py3k`` to do this as cleanly as possible to support Python 2.7 where the ``open`` function does not expect an encoding argument.
So this is on 64 bit Fedora Linux as part of trying to package Biopython 1.67 - did everything work on Biopython 1.66?

Can you reproduce this outside of the packaging setup? e.g.

```
wget http://biopython.org/DIST/biopython-1.67.tar.gz
tar -zxvf biopython-1.67.tar.gz
cd biopython-1.67
/usr/bin/python3 setup.py build
cd Tests
/usr/bin/python3 run_tests.py --offline -v test_NCBIXML.py
```

Is there anything unusual in the locale settings?

(Right now the closest I have to reproduce this is Python 3.5.0, but I'll update that to Python 3.5.1 just in case that matters)

Hi,

> So this is on 64 bit Fedora Linux as part of trying to package Biopython 1.67 - did everything work on Biopython 1.66?

Yes, with Python-3.5 .

> Can you reproduce this outside of the packaging setup?

I can't try now, I need Fedora 24 at least (it's a beta).
This error is not reproduced outside of the packaging setup on Fedora 23 with Python-3.4.

I can't reproduce this on Python 3.5.1 on CentOS 6.

My guess is something subtle to do with unicode and locales on the Fedora 24 beta - do you understand https://bugzilla.redhat.com/ enough to pull out just bugs filed against the beta?

It looks this bug on Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=1262082

Can you see what `$LANG` is set to on this problem machine? e.g.

```
echo $LANG
```

That might be enough for us to reproduce this.

> echo $LANG

en_US.UTF-8

Unfortunately that doesn't trigger the problem on my 64-bit CentOS 6 machine:

```
$ LANG=en_US.UTF-8 python3.5 run_tests.py --offline -v test_NCBIXML.py
Skipping any tests requiring internet access
Python version: 3.5.1 (default, Jun 15 2016, 17:47:04) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-16)]
Operating system: posix linux
test_NCBIXML ... ok
test_xml_2212L_blastn_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTN 2.2.12, gi|1348916|gb|G26684.1|G26684 (xml_2212L_blastn_001) ... ok
test_xml_2212L_blastp_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.12, gi|49176427|ref|NP_418280.3| (xml_2212L_blastp_001) ... ok
test_xml_2212L_blastx_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTX 2.2.12, gi|1347369|gb|G25137.1|G25137 (xml_2212L_blastx_001) ... ok
test_xml_2212L_tblastn_001 (test_NCBIXML.TestNCBIXML)
Parsing TBLASTN 2.2.12, gi|729325|sp|P39483|DHG2_BACME (xml_2212L_tblastn_001) ... ok
test_xml_2212L_tblastx_001 (test_NCBIXML.TestNCBIXML)
Parsing TBLASTX 2.2.12, gi|1348853|gb|G26621.1|G26621, BLOSUM80 (xml_2212L_tblastx_001) ... ok
test_xml_2218L_blastp_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.18, Fake query (xml_2218L_blastp_001) ... ok
test_xml_2218L_rpsblast_001 (test_NCBIXML.TestNCBIXML)
Parsing PSI-BLASTP 2.2.18, single query which converges in 3 iterations (xml_2218L_rpsblast_001) ... ok
test_xml_2218_blastp_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.18+, gi|160837788|ref|NP_075631.2| (xml_2218_blastp_001) ... ok
test_xml_2218_blastp_002 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.18+, SwissProt Q08386 and P07175, no hits (xml_2218_blastp_002) ... ok
test_xml_2222_blastp_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.22+, multiple queries against NR (xml_2222_blastp_001) ... ok
test_xml_2222_blastx_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTX 2.2.22+, multiple queries against NR (xml_2222_blastx_001) ... ok
----------------------------------------------------------------------
Ran 1 test in 0.469 seconds
```

This machine's original setting:

```
$ echo $LANG
en_GB.UTF-8
```

However, deliberately using `LANG=C` seems to reproduce the exception you reported:

```
$ LANG=C python3.5 run_tests.py --offline -v test_NCBIXML.py
Skipping any tests requiring internet access
Python version: 3.5.1 (default, Jun 15 2016, 17:47:04) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-16)]
Operating system: posix linux
test_NCBIXML ... FAIL
test_xml_2212L_blastn_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTN 2.2.12, gi|1348916|gb|G26684.1|G26684 (xml_2212L_blastn_001) ... ERROR
test_xml_2212L_blastp_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.12, gi|49176427|ref|NP_418280.3| (xml_2212L_blastp_001) ... ERROR
test_xml_2212L_blastx_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTX 2.2.12, gi|1347369|gb|G25137.1|G25137 (xml_2212L_blastx_001) ... ERROR
test_xml_2212L_tblastn_001 (test_NCBIXML.TestNCBIXML)
Parsing TBLASTN 2.2.12, gi|729325|sp|P39483|DHG2_BACME (xml_2212L_tblastn_001) ... ERROR
test_xml_2212L_tblastx_001 (test_NCBIXML.TestNCBIXML)
Parsing TBLASTX 2.2.12, gi|1348853|gb|G26621.1|G26621, BLOSUM80 (xml_2212L_tblastx_001) ... ERROR
test_xml_2218L_blastp_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.18, Fake query (xml_2218L_blastp_001) ... ok
test_xml_2218L_rpsblast_001 (test_NCBIXML.TestNCBIXML)
Parsing PSI-BLASTP 2.2.18, single query which converges in 3 iterations (xml_2218L_rpsblast_001) ... ok
test_xml_2218_blastp_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.18+, gi|160837788|ref|NP_075631.2| (xml_2218_blastp_001) ... ERROR
test_xml_2218_blastp_002 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.18+, SwissProt Q08386 and P07175, no hits (xml_2218_blastp_002) ... ERROR
test_xml_2222_blastp_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.22+, multiple queries against NR (xml_2222_blastp_001) ... ok
test_xml_2222_blastx_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTX 2.2.22+, multiple queries against NR (xml_2222_blastx_001) ... ok

======================================================================
ERROR: test_xml_2212L_blastn_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTN 2.2.12, gi|1348916|gb|G26684.1|G26684 (xml_2212L_blastn_001)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home_local/buildslave/repositories/biopython/Tests/test_NCBIXML.py", line 1407, in test_xml_2212L_blastn_001
    record = next(records)
  File "/home_local/buildslave/repositories/biopython/build/lib.linux-x86_64-3.5/Bio/Blast/NCBIXML.py", line 570, in parse
    text = handle.read(BLOCK)
  File "/home_local/buildslave/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 331: ordinal not in range(128)

======================================================================
ERROR: test_xml_2212L_blastp_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.12, gi|49176427|ref|NP_418280.3| (xml_2212L_blastp_001)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home_local/buildslave/repositories/biopython/Tests/test_NCBIXML.py", line 22, in test_xml_2212L_blastp_001
    record = next(records)
  File "/home_local/buildslave/repositories/biopython/build/lib.linux-x86_64-3.5/Bio/Blast/NCBIXML.py", line 570, in parse
    text = handle.read(BLOCK)
  File "/home_local/buildslave/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 331: ordinal not in range(128)

======================================================================
ERROR: test_xml_2212L_blastx_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTX 2.2.12, gi|1347369|gb|G25137.1|G25137 (xml_2212L_blastx_001)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home_local/buildslave/repositories/biopython/Tests/test_NCBIXML.py", line 1437, in test_xml_2212L_blastx_001
    record = next(records)
  File "/home_local/buildslave/repositories/biopython/build/lib.linux-x86_64-3.5/Bio/Blast/NCBIXML.py", line 570, in parse
    text = handle.read(BLOCK)
  File "/home_local/buildslave/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 331: ordinal not in range(128)

======================================================================
ERROR: test_xml_2212L_tblastn_001 (test_NCBIXML.TestNCBIXML)
Parsing TBLASTN 2.2.12, gi|729325|sp|P39483|DHG2_BACME (xml_2212L_tblastn_001)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home_local/buildslave/repositories/biopython/Tests/test_NCBIXML.py", line 1457, in test_xml_2212L_tblastn_001
    record = next(records)
  File "/home_local/buildslave/repositories/biopython/build/lib.linux-x86_64-3.5/Bio/Blast/NCBIXML.py", line 570, in parse
    text = handle.read(BLOCK)
  File "/home_local/buildslave/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 333: ordinal not in range(128)

======================================================================
ERROR: test_xml_2212L_tblastx_001 (test_NCBIXML.TestNCBIXML)
Parsing TBLASTX 2.2.12, gi|1348853|gb|G26621.1|G26621, BLOSUM80 (xml_2212L_tblastx_001)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home_local/buildslave/repositories/biopython/Tests/test_NCBIXML.py", line 1477, in test_xml_2212L_tblastx_001
    record = next(records)
  File "/home_local/buildslave/repositories/biopython/build/lib.linux-x86_64-3.5/Bio/Blast/NCBIXML.py", line 570, in parse
    text = handle.read(BLOCK)
  File "/home_local/buildslave/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 333: ordinal not in range(128)

======================================================================
ERROR: test_xml_2218_blastp_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.18+, gi|160837788|ref|NP_075631.2| (xml_2218_blastp_001)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home_local/buildslave/repositories/biopython/Tests/test_NCBIXML.py", line 1499, in test_xml_2218_blastp_001
    record = next(records)
  File "/home_local/buildslave/repositories/biopython/build/lib.linux-x86_64-3.5/Bio/Blast/NCBIXML.py", line 570, in parse
    text = handle.read(BLOCK)
  File "/home_local/buildslave/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 313: ordinal not in range(128)

======================================================================
ERROR: test_xml_2218_blastp_002 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.18+, SwissProt Q08386 and P07175, no hits (xml_2218_blastp_002)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home_local/buildslave/repositories/biopython/Tests/test_NCBIXML.py", line 1563, in test_xml_2218_blastp_002
    record = next(records)
  File "/home_local/buildslave/repositories/biopython/build/lib.linux-x86_64-3.5/Bio/Blast/NCBIXML.py", line 570, in parse
    text = handle.read(BLOCK)
  File "/home_local/buildslave/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 313: ordinal not in range(128)

----------------------------------------------------------------------
Ran 1 test in 0.151 seconds

FAILED (failures = 1)
```

I suspect the problematic data is `Alejandro A. Schäffer`, one of the BLAST authors listed in some of the XML output as:

```
<BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (
1997), &quot;Gapped BLAST and PSI-BLAST: a new generation of protein database search programs&quot;, Nucleic Acids Res. 25:3389-3402.</BlastOutput_ref
erence>
```

This occurs in all the test files where `LANG=C` makes the test fail (and I think ONLY those files):

```
$ grep Alejandro xml_2212L_blastn_001.xml xml_2212L_blastp_001.xml xml_2212L_blastx_001.xml xml_2212L_tblastn_001.xml xml_2212L_tblastx_001.xml xml_2218_blastp_001.xml xml_2218_blastp_002.xml 
xml_2212L_blastn_001.xml:  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), &quot;Gapped BLAST and PSI-BLAST: a new generation of protein database search programs&quot;, Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
xml_2212L_blastp_001.xml:  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), &quot;Gapped BLAST and PSI-BLAST: a new generation of protein database search programs&quot;, Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
xml_2212L_blastx_001.xml:  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), &quot;Gapped BLAST and PSI-BLAST: a new generation of protein database search programs&quot;, Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
xml_2212L_tblastn_001.xml:  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), &quot;Gapped BLAST and PSI-BLAST: a new generation of protein database search programs&quot;, Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
xml_2212L_tblastx_001.xml:  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), &quot;Gapped BLAST and PSI-BLAST: a new generation of protein database search programs&quot;, Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
xml_2218_blastp_001.xml:  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), &quot;Gapped BLAST and PSI-BLAST: a new generation of protein database search programs&quot;, Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
xml_2218_blastp_002.xml:  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), "Gapped BLAST and PSI-BLAST: a new generation of protein database search programs", Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
```

The reference formatting looks like something the NCBI have tweaked with different version of the legacy BLAST tool, and its replacement BLAST+. Also which reference is given will depend on the tool/algorithm used.

Interestingly in some of the BLAST XML files this appears as:

```
<BlastOutput_reference>Stephen F. Altschul, Thomas L. Madden, Alejandro A. Sch&amp;auml;ffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), &quot;Gapped BLAST and PSI-BLAST: a new generation of protein database search programs&quot;, Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
```

Here the `&auml;` is being used (double escaped) of the lower-case a with dots over it.

It seems the NCBI have never used an explicit encoding in their XML output files, e.g. nothing like this:

```
<?xml version="1.0" encoding="UTF-8"?>
```

Once we come to process the reference text, the exact encoding is clearly important here, note:

```
$ python3.5 -c "print('Schäffer'.encode('UTF-8'))"
b'Sch\xc3\xa4ffer'
$ python3.5 -c "print('Schäffer'.encode('latin-1'))"
b'Sch\xe4ffer'
```

I'm a little confused about byte character `0xc3` (not used in the latin-1 encoding), but that does seem to match the exception we're seeing.

Regarding this:

```
$ python3.5 -c "print('Schäffer'.encode('UTF-8'))"
b'Sch\xc3\xa4ffer'
$ python3.5 -c "print('Schäffer'.encode('latin-1'))"
b'Sch\xe4ffer'
```

Looking at the raw file,

```
$ hexdump -C xml_2218_blastp_002.xml | head -n 20
00000000  3c 3f 78 6d 6c 20 76 65  72 73 69 6f 6e 3d 22 31  |<?xml version="1|
00000010  2e 30 22 3f 3e 0a 3c 21  44 4f 43 54 59 50 45 20  |.0"?>.<!DOCTYPE |
00000020  42 6c 61 73 74 4f 75 74  70 75 74 20 50 55 42 4c  |BlastOutput PUBL|
00000030  49 43 20 22 2d 2f 2f 4e  43 42 49 2f 2f 4e 43 42  |IC "-//NCBI//NCB|
00000040  49 20 42 6c 61 73 74 4f  75 74 70 75 74 2f 45 4e  |I BlastOutput/EN|
00000050  22 20 22 4e 43 42 49 5f  42 6c 61 73 74 4f 75 74  |" "NCBI_BlastOut|
00000060  70 75 74 2e 64 74 64 22  3e 0a 3c 42 6c 61 73 74  |put.dtd">.<Blast|
00000070  4f 75 74 70 75 74 3e 0a  20 20 3c 42 6c 61 73 74  |Output>.  <Blast|
00000080  4f 75 74 70 75 74 5f 70  72 6f 67 72 61 6d 3e 62  |Output_program>b|
00000090  6c 61 73 74 70 3c 2f 42  6c 61 73 74 4f 75 74 70  |lastp</BlastOutp|
000000a0  75 74 5f 70 72 6f 67 72  61 6d 3e 0a 20 20 3c 42  |ut_program>.  <B|
000000b0  6c 61 73 74 4f 75 74 70  75 74 5f 76 65 72 73 69  |lastOutput_versi|
000000c0  6f 6e 3e 42 4c 41 53 54  50 20 32 2e 32 2e 31 38  |on>BLASTP 2.2.18|
000000d0  2b 3c 2f 42 6c 61 73 74  4f 75 74 70 75 74 5f 76  |+</BlastOutput_v|
000000e0  65 72 73 69 6f 6e 3e 0a  20 20 3c 42 6c 61 73 74  |ersion>.  <Blast|
000000f0  4f 75 74 70 75 74 5f 72  65 66 65 72 65 6e 63 65  |Output_reference|
00000100  3e 41 6c 74 73 63 68 75  6c 2c 20 53 74 65 70 68  |>Altschul, Steph|
00000110  65 6e 20 46 2e 2c 20 54  68 6f 6d 61 73 20 4c 2e  |en F., Thomas L.|
00000120  20 4d 61 64 64 65 6e 2c  20 41 6c 65 6a 61 6e 64  | Madden, Alejand|
00000130  72 6f 20 41 2e 20 53 63  68 c3 a4 66 66 65 72 2c  |ro A. Sch..ffer,|
```

This is clearly consistent with the `b'Sch\xc3\xa4ffer'` form (0xC3 0xA4), which suggests UTF-8 encoding rather than latin-1.

Minimal test case:

```
$ cd Tests/Blast
$ LANG=en_US.UTF-8 python3.5 -c "h = open('xml_2218_blastp_002.xml'); print(h.read(400))"
<?xml version="1.0"?>
<!DOCTYPE BlastOutput PUBLIC "-//NCBI//NCBI BlastOutput/EN" "NCBI_BlastOutput.dtd">
<BlastOutput>
  <BlastOutput_program>blastp</BlastOutput_program>
  <BlastOutput_version>BLASTP 2.2.18+</BlastOutput_version>
  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), "Gapped BLA
$ LANG=C python3.5 -c "h = open('xml_2218_blastp_002.xml'); print(h.read(400))"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home_local/buildslave/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 313: ordinal not in range(128)
```

I presume with `LANG=C` the default encoding breaks, so we need to set UTF-8 explicitly for BLAST XML files? See also https://pythonhosted.org/kitchen/unicode-frustrations.html

Could you try specifying the encoding directly?

``` bash
LANG=C python3.5 -c "h = open('xml_2218_blastp_002.xml', encoding='utf-8'); print(h.read(400))"
```

`LANG=C` doesn't do anything on my machine, so I can't reproduce the error and test this myself.

Details about my setup:
➜  Blast git:(master) python -c "import Bio; print(Bio.__version__)"
1.66
➜  Blast git:(master) python --version
Python 3.5.1 :: Anaconda 2.4.0 (x86_64)
➜  Blast git:(master) uname -a
Darwin jackfruit.local 15.5.0 Darwin Kernel Version 15.5.0: Tue Apr 19 18:36:36 PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64

@smsaladi sadly no joy with the explicit encoding in the open call, Linux 64:

```
$ LANG=en_US.UTF-8 python3.5 -c "h = open('xml_2218_blastp_002.xml', encoding='utf-8'); print(h.read(400))"
<?xml version="1.0"?>
<!DOCTYPE BlastOutput PUBLIC "-//NCBI//NCBI BlastOutput/EN" "NCBI_BlastOutput.dtd">
<BlastOutput>
  <BlastOutput_program>blastp</BlastOutput_program>
  <BlastOutput_version>BLASTP 2.2.18+</BlastOutput_version>
  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), "Gapped BLA
$ LANG=C python3.5 -c "h = open('xml_2218_blastp_002.xml', encoding='utf-8'); print(h.read(400))"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character '\xe4' in position 313: ordinal not in range(128)
```

Interestingly I _can_ reproduce this on Mac OS X, using a self-compiled Python 3.3.3rc1, Python 3.4.4 or Python 3.5.0,

```
peter-cocks-mac-pro:Blast pjcock$ LANG=en_US.UTF-8 python3.5 -c "h = open('xml_2218_blastp_002.xml'); print(h.read(400))"
<?xml version="1.0"?>
<!DOCTYPE BlastOutput PUBLIC "-//NCBI//NCBI BlastOutput/EN" "NCBI_BlastOutput.dtd">
<BlastOutput>
  <BlastOutput_program>blastp</BlastOutput_program>
  <BlastOutput_version>BLASTP 2.2.18+</BlastOutput_version>
  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), "Gapped BLA
peter-cocks-mac-pro:Blast pjcock$ LANG=C python3.5 -c "h = open('xml_2218_blastp_002.xml'); print(h.read(400))"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/pjcock/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 313: ordinal not in range(128)
peter-cocks-mac-pro:Blast pjcock$ LANG=C python3.5 -c "h = open('xml_2218_blastp_002.xml', encoding='utf-8'); print(h.read(400))"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character '\xe4' in position 313: ordinal not in range(128)
```

It looks like the key difference between our Mac setups is the way Python 3 was installed (mine are compiled from source using `--prefix=$HOME` and breaks, yours is from Anaconda and works).

```
peter-cocks-mac-pro:Blast pjcock$ python3.5 --version
Python 3.5.0
$ uname -a
Darwin peter-cocks-mac-pro.local 15.5.0 Darwin Kernel Version 15.5.0: Tue Apr 19 18:36:36 PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64
```

Seeing this again during work to build wheels for Biopython 1.70 under TravisCI (using a quite different setup to our TravisCI continuous integration tests),

e.g. https://travis-ci.org/biopython/biopython-wheels/jobs/252754295

This also affects other tests too:

```
======================================================================
ERROR: test_xml_2212L_blastn_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTN 2.2.12, gi|1348916|gb|G26684.1|G26684 (xml_2212L_blastn_001)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_NCBIXML.py", line 1407, in test_xml_2212L_blastn_001
    record = next(records)
  File "/io/biopython/Bio/Blast/NCBIXML.py", line 583, in parse
    text = handle.read(BLOCK)
  File "/venv/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 0xc3 in position 331: ordinal not in range(128)
======================================================================
ERROR: test_xml_2212L_blastp_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.12, gi|49176427|ref|NP_418280.3| (xml_2212L_blastp_001)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_NCBIXML.py", line 22, in test_xml_2212L_blastp_001
    record = next(records)
  File "/io/biopython/Bio/Blast/NCBIXML.py", line 583, in parse
    text = handle.read(BLOCK)
  File "/venv/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 0xc3 in position 331: ordinal not in range(128)
======================================================================
ERROR: test_xml_2212L_blastx_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTX 2.2.12, gi|1347369|gb|G25137.1|G25137 (xml_2212L_blastx_001)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_NCBIXML.py", line 1437, in test_xml_2212L_blastx_001
    record = next(records)
  File "/io/biopython/Bio/Blast/NCBIXML.py", line 583, in parse
    text = handle.read(BLOCK)
  File "/venv/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 0xc3 in position 331: ordinal not in range(128)
======================================================================
ERROR: test_xml_2212L_tblastn_001 (test_NCBIXML.TestNCBIXML)
Parsing TBLASTN 2.2.12, gi|729325|sp|P39483|DHG2_BACME (xml_2212L_tblastn_001)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_NCBIXML.py", line 1457, in test_xml_2212L_tblastn_001
    record = next(records)
  File "/io/biopython/Bio/Blast/NCBIXML.py", line 583, in parse
    text = handle.read(BLOCK)
  File "/venv/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 0xc3 in position 333: ordinal not in range(128)
======================================================================
ERROR: test_xml_2212L_tblastx_001 (test_NCBIXML.TestNCBIXML)
Parsing TBLASTX 2.2.12, gi|1348853|gb|G26621.1|G26621, BLOSUM80 (xml_2212L_tblastx_001)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_NCBIXML.py", line 1477, in test_xml_2212L_tblastx_001
    record = next(records)
  File "/io/biopython/Bio/Blast/NCBIXML.py", line 583, in parse
    text = handle.read(BLOCK)
  File "/venv/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 0xc3 in position 333: ordinal not in range(128)
======================================================================
ERROR: test_xml_2218_blastp_001 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.18+, gi|160837788|ref|NP_075631.2| (xml_2218_blastp_001)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_NCBIXML.py", line 1499, in test_xml_2218_blastp_001
    record = next(records)
  File "/io/biopython/Bio/Blast/NCBIXML.py", line 583, in parse
    text = handle.read(BLOCK)
  File "/venv/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 0xc3 in position 313: ordinal not in range(128)
======================================================================
ERROR: test_xml_2218_blastp_002 (test_NCBIXML.TestNCBIXML)
Parsing BLASTP 2.2.18+, SwissProt Q08386 and P07175, no hits (xml_2218_blastp_002)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_NCBIXML.py", line 1563, in test_xml_2218_blastp_002
    record = next(records)
  File "/io/biopython/Bio/Blast/NCBIXML.py", line 583, in parse
    text = handle.read(BLOCK)
  File "/venv/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 0xc3 in position 313: ordinal not in range(128)
======================================================================
ERROR: test_trees_and_taxa_block (test_Nexus.OldSelfTests)
Basic tree file with TREES and TAXA block
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Nexus.py", line 32, in test_trees_and_taxa_block
    nexus1.read('Nexus/bats.nex')
  File "/io/biopython/Bio/Nexus/Nexus.py", line 635, in read
    file_contents = fp.read()
  File "/venv/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 0xc3 in position 398: ordinal not in range(128)
======================================================================
ERROR: test_convert_phyloxml_binary (test_Phylo.IOTests)
Try writing phyloxml to a binary handle; fail on Py3.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 157, in test_convert_phyloxml_binary
    trees, out_handle, "phyloxml")
  File "/usr/lib/python3.4/unittest/case.py", line 704, in assertRaises
    return context.handle('assertRaises', callableObj, args, kwargs)
  File "/usr/lib/python3.4/unittest/case.py", line 162, in handle
    callable_obj(*args, **kwargs)
  File "/io/biopython/Bio/Phylo/_io.py", line 81, in write
    n = getattr(supported_formats[format], 'write')(trees, fp, **kwargs)
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 134, in write
    return Writer(obj).write(file, encoding=encoding, indent=indent)
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 678, in __init__
    self._tree = ElementTree.ElementTree(self.phyloxml(phyloxml))
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 690, in phyloxml
    for tree in obj.phylogenies:
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 130, in <genexpr>
    obj = PX.Phyloxml({}, phylogenies=(fix_single(t) for t in obj))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_convert_phyloxml_filename (test_Phylo.IOTests)
Write phyloxml to a given filename.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 170, in test_convert_phyloxml_filename
    count = Phylo.write(trees, tmp_filename, "phyloxml")
  File "/io/biopython/Bio/Phylo/_io.py", line 81, in write
    n = getattr(supported_formats[format], 'write')(trees, fp, **kwargs)
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 134, in write
    return Writer(obj).write(file, encoding=encoding, indent=indent)
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 678, in __init__
    self._tree = ElementTree.ElementTree(self.phyloxml(phyloxml))
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 690, in phyloxml
    for tree in obj.phylogenies:
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 130, in <genexpr>
    obj = PX.Phyloxml({}, phylogenies=(fix_single(t) for t in obj))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_convert_phyloxml_text (test_Phylo.IOTests)
Write phyloxml to a text handle.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 163, in test_convert_phyloxml_text
    count = Phylo.write(trees, out_handle, "phyloxml")
  File "/io/biopython/Bio/Phylo/_io.py", line 81, in write
    n = getattr(supported_formats[format], 'write')(trees, fp, **kwargs)
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 134, in write
    return Writer(obj).write(file, encoding=encoding, indent=indent)
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 678, in __init__
    self._tree = ElementTree.ElementTree(self.phyloxml(phyloxml))
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 690, in phyloxml
    for tree in obj.phylogenies:
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 130, in <genexpr>
    obj = PX.Phyloxml({}, phylogenies=(fix_single(t) for t in obj))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_newick_read_single3 (test_Phylo.IOTests)
Read Nexus file with one tree.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 53, in test_newick_read_single3
    tree = Phylo.read(EX_NEXUS2, 'nexus')
  File "/io/biopython/Bio/Phylo/_io.py", line 63, in read
    tree = next(tree_gen)
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/NexusIO.py", line 38, in parse
    nex = Nexus.Nexus(handle)
  File "/io/biopython/Bio/Nexus/Nexus.py", line 614, in __init__
    self.read(input)
  File "/io/biopython/Bio/Nexus/Nexus.py", line 635, in read
    file_contents = fp.read()
  File "/venv/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 0xc3 in position 398: ordinal not in range(128)
======================================================================
ERROR: test_collapse (test_Phylo.MixinTests)
TreeMixin: collapse() method.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
    self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_collapse_all (test_Phylo.MixinTests)
TreeMixin: collapse_all() method.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
    self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_common_ancestor (test_Phylo.MixinTests)
TreeMixin: common_ancestor() method.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
    self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_depths (test_Phylo.MixinTests)
TreeMixin: depths() method.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
    self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_distance (test_Phylo.MixinTests)
TreeMixin: distance() method.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
    self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_find_clades (test_Phylo.MixinTests)
TreeMixin: find_clades() method.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
    self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_find_elements (test_Phylo.MixinTests)
TreeMixin: find_elements() method.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
    self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_find_terminal (test_Phylo.MixinTests)
TreeMixin: find_elements() with terminal argument.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
    self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_get_path (test_Phylo.MixinTests)
TreeMixin: get_path() method.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
    self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_is_bifurcating (test_Phylo.MixinTests)
TreeMixin: is_bifurcating() method.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
    self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_is_monophyletic (test_Phylo.MixinTests)
TreeMixin: is_monophyletic() method.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
    self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_ladderize (test_Phylo.MixinTests)
TreeMixin: ladderize() method.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
    self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_prune (test_Phylo.MixinTests)
TreeMixin: prune() method.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
    self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_split (test_Phylo.MixinTests)
TreeMixin: split() method.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
    self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_total_branch_length (test_Phylo.MixinTests)
TreeMixin: total_branch_length() method.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
    self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_trace (test_Phylo.MixinTests)
TreeMixin: trace() method.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 266, in setUp
    self.phylogenies = list(Phylo.parse(EX_PHYLO, 'phyloxml'))
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_str (test_Phylo.TreeTests)
Tree.__str__: pretty-print to a string.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Phylo.py", line 257, in test_str
    tree = Phylo.read(source, 'phyloxml')
  File "/io/biopython/Bio/Phylo/_io.py", line 63, in read
    tree = next(tree_gen)
  File "/io/biopython/Bio/Phylo/_io.py", line 51, in parse
    for tree in getattr(supported_formats[format], 'parse')(fp, **kwargs):
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 98, in parse
    return Parser(file).parse()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 1041: ordinal not in range(128)
======================================================================
ERROR: test_phylo (test_PhyloXML.WriterTests)
Round-trip parsing and serialization of phyloxml_examples.xml.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_PhyloXML.py", line 578, in test_phylo
    'test_Taxonomy', 'test_Uri',
  File "/io/biopython/Tests/test_PhyloXML.py", line 511, in _rewrite_and_call
    phx = PhyloXMLIO.read(infile)
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 86, in read
    return Parser(file).read()
  File "/io/biopython/Bio/Phylo/PhyloXMLIO.py", line 296, in __init__
    event, root = next(context)
  File "/usr/lib/python3.4/xml/etree/ElementTree.py", line 1302, in __next__
    data = self._file.read(16 * 1024)
  File "/venv/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 0xc3 in position 13090: ordinal not in range(128)
======================================================================
ERROR: test_SeqIO
----------------------------------------------------------------------
Traceback (most recent call last):
  File "run_tests.py", line 439, in runTest
    suite = loader.loadTestsFromName(name)
  File "/usr/lib/python3.4/unittest/loader.py", line 105, in loadTestsFromName
    module = __import__('.'.join(parts_copy))
  File "/io/biopython/Tests/test_SeqIO.py", line 477, in <module>
    records = list(SeqIO.parse(handle=h, format=t_format))
  File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
    for r in i:
  File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
    for event, node in self._events:
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
    rc = self.getEvent()
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
    buf = self.stream.read(self.bufsize)
  File "/venv/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 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_duplicated_dbxref (test_SeqIO_SeqXML.TestDetailedRead)
Read multiple cross references to a single source
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 50, in setUp
    self.records[key] = list(SeqIO.parse(test_files[key][0], "seqxml"))
  File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
    for r in i:
  File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
    for event, node in self._events:
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
    rc = self.getEvent()
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
    buf = self.stream.read(self.bufsize)
  File "/venv/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 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_duplicated_property (test_SeqIO_SeqXML.TestDetailedRead)
Read property with multiple values
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 50, in setUp
    self.records[key] = list(SeqIO.parse(test_files[key][0], "seqxml"))
  File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
    for r in i:
  File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
    for event, node in self._events:
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
    rc = self.getEvent()
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
    buf = self.stream.read(self.bufsize)
  File "/venv/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 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_empty_description (test_SeqIO_SeqXML.TestDetailedRead)
Check empty description.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 50, in setUp
    self.records[key] = list(SeqIO.parse(test_files[key][0], "seqxml"))
  File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
    for r in i:
  File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
    for event, node in self._events:
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
    rc = self.getEvent()
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
    buf = self.stream.read(self.bufsize)
  File "/venv/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 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_full_characters_set_read (test_SeqIO_SeqXML.TestDetailedRead)
Read full characters set for each type
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 50, in setUp
    self.records[key] = list(SeqIO.parse(test_files[key][0], "seqxml"))
  File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
    for r in i:
  File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
    for event, node in self._events:
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
    rc = self.getEvent()
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
    buf = self.stream.read(self.bufsize)
  File "/venv/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 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_global_species (test_SeqIO_SeqXML.TestDetailedRead)
Check global species.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 50, in setUp
    self.records[key] = list(SeqIO.parse(test_files[key][0], "seqxml"))
  File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
    for r in i:
  File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
    for event, node in self._events:
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
    rc = self.getEvent()
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
    buf = self.stream.read(self.bufsize)
  File "/venv/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 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_local_source_definition (test_SeqIO_SeqXML.TestDetailedRead)
Check local source.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 50, in setUp
    self.records[key] = list(SeqIO.parse(test_files[key][0], "seqxml"))
  File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
    for r in i:
  File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
    for event, node in self._events:
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
    rc = self.getEvent()
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
    buf = self.stream.read(self.bufsize)
  File "/venv/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 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_local_species (test_SeqIO_SeqXML.TestDetailedRead)
Check local species.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 50, in setUp
    self.records[key] = list(SeqIO.parse(test_files[key][0], "seqxml"))
  File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
    for r in i:
  File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
    for event, node in self._events:
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
    rc = self.getEvent()
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
    buf = self.stream.read(self.bufsize)
  File "/venv/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 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_read_minimal_required (test_SeqIO_SeqXML.TestDetailedRead)
Check minimal record.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 50, in setUp
    self.records[key] = list(SeqIO.parse(test_files[key][0], "seqxml"))
  File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
    for r in i:
  File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
    for event, node in self._events:
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
    rc = self.getEvent()
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
    buf = self.stream.read(self.bufsize)
  File "/venv/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 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_special_characters_desc (test_SeqIO_SeqXML.TestDetailedRead)
Read special XML characters in description.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 50, in setUp
    self.records[key] = list(SeqIO.parse(test_files[key][0], "seqxml"))
  File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
    for r in i:
  File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
    for event, node in self._events:
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
    rc = self.getEvent()
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
    buf = self.stream.read(self.bufsize)
  File "/venv/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 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_unicode_characters_desc (test_SeqIO_SeqXML.TestDetailedRead)
Test special unicode characters in the description.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 50, in setUp
    self.records[key] = list(SeqIO.parse(test_files[key][0], "seqxml"))
  File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
    for r in i:
  File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
    for event, node in self._events:
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
    rc = self.getEvent()
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
    buf = self.stream.read(self.bufsize)
  File "/venv/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 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_read_write_rna (test_SeqIO_SeqXML.TestReadAndWrite)
Read and write RNA.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 115, in test_read_write_rna
    read1_records = list(SeqIO.parse(test_files["rna"][0], "seqxml"))
  File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
    for r in i:
  File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
    for event, node in self._events:
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
    rc = self.getEvent()
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
    buf = self.stream.read(self.bufsize)
  File "/venv/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 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_check_SeqIO (test_SeqIO_SeqXML.TestSimpleRead)
Files readable using parser via SeqIO.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_SeqIO_SeqXML.py", line 40, in test_check_SeqIO
    records = list(SeqIO.parse(test_files[key][0], "seqxml"))
  File "/io/biopython/Bio/SeqIO/__init__.py", line 611, in parse
    for r in i:
  File "/io/biopython/Bio/SeqIO/SeqXmlIO.py", line 58, in __iter__
    for event, node in self._events:
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 226, in __next__
    rc = self.getEvent()
  File "/usr/lib/python3.4/xml/dom/pulldom.py", line 255, in getEvent
    buf = self.stream.read(self.bufsize)
  File "/venv/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 0xc3 in position 797: ordinal not in range(128)
======================================================================
ERROR: test_doctests (test_Tutorial.TutorialTestCase)
Run tutorial doctests.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/io/biopython/Tests/test_Tutorial.py", line 256, in test_doctests
    (len(failures), ", ".join(failures)))
ValueError: 1 Tutorial doctests failed: test_chapter_phylo_line_00074
----------------------------------------------------------------------
Ran 273 tests in 86.588 seconds
FAILED (failures = 7)
```

*Update*: I later added locale reporting to these builds:

```
$ locale
LANG=
LANGUAGE=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=
```
For my reference, how to find some of the problem entries with grep tested on Mac OS X.

We have example files with the composed Unicode form (NFC), e.g. for the a-with-umlaut:

```bash
$ grep $'\xc3\xa4' */*.xml
Blast/xml_2212L_blastn_001.xml:  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), &quot;Gapped BLAST and PSI-BLAST: a new generation of protein database search programs&quot;, Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
Blast/xml_2212L_blastp_001.xml:  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), &quot;Gapped BLAST and PSI-BLAST: a new generation of protein database search programs&quot;, Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
Blast/xml_2212L_blastx_001.xml:  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), &quot;Gapped BLAST and PSI-BLAST: a new generation of protein database search programs&quot;, Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
Blast/xml_2212L_tblastn_001.xml:  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), &quot;Gapped BLAST and PSI-BLAST: a new generation of protein database search programs&quot;, Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
Blast/xml_2212L_tblastx_001.xml:  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), &quot;Gapped BLAST and PSI-BLAST: a new generation of protein database search programs&quot;, Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
Blast/xml_2218_blastp_001.xml:  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), &quot;Gapped BLAST and PSI-BLAST: a new generation of protein database search programs&quot;, Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
Blast/xml_2218_blastp_002.xml:  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), "Gapped BLAST and PSI-BLAST: a new generation of protein database search programs", Nucleic Acids Res. 25:3389-3402.</BlastOutput_reference>
SeqXML/rna_example.xml:        <description>åÅüöÖßøä¢£$€香肠</description>
```

e.g. for the u-with-umlaut:

``` bash
$ echo $'\xc3\xbc'
ü
$ grep $'\xc3\xbc' */*.xml
PhyloXML/distribution.xml:            <desc>ETH Zürich</desc>
PhyloXML/phyloxml_examples.xml:                  <desc>ETH Zürich</desc>
SeqXML/rna_example.xml:        <description>åÅüöÖßøä¢£$€香肠</description>
```

We do not have to worry about the decomposed Unicode form (NFD), used by the Mac OS file system, which we can get using:

```bash
$ echo -n $'\xc3\xa4' | iconv -t UTF8-MAC | hexdump -C
00000000  61 cc 88                                          |a..|
00000003
$ echo $'a\xcc\x88'
ä
$ grep $'a\xcc\x88' */*.xml
```

And for the ``u`` and umlaut diacritical character in decomposed form:
 
```
$ echo -n $'\xc3\xbc' | iconv -t UTF8-MAC | hexdump -C
00000000  75 cc 88                                          |u..|
00000003
$ echo $'u\xcc\x88'
ü
$ grep $'u\xcc\x88' */*.xml
```
Looking at this with fresh eyes, @smsaladi was right about using the encoding argument to open (under Python 3), I was tricked because with that fix the print can fail with the default locale.

On Mac OS, with my default locale or explicitly using USA settings, things work:

```
$ LANG=en_US.UTF-8 python3.6 -c "h = open('xml_2218_blastp_002.xml', encoding='utf-8'); l=h.read(400); print(l)"
<?xml version="1.0"?>
<!DOCTYPE BlastOutput PUBLIC "-//NCBI//NCBI BlastOutput/EN" "NCBI_BlastOutput.dtd">
<BlastOutput>
  <BlastOutput_program>blastp</BlastOutput_program>
  <BlastOutput_version>BLASTP 2.2.18+</BlastOutput_version>
  <BlastOutput_reference>Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schäffer, Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997), "Gapped BLA
```

However, forcibly using ``LANG=C`` so that the default encoding is just ``ascii``, the read fails:

```
$ LANG=C python3.6 -c "h = open('xml_2218_blastp_002.xml'); l=h.read(400)"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/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 313: ordinal not in range(128)
```

Adding the open argument that works:

```
$ LANG=C python3.6 -c "h = open('xml_2218_blastp_002.xml', encoding='utf-8'); l=h.read(400)"
```

But putting the print in breaks things again:

```
$ LANG=C python3.6 -c "h = open('xml_2218_blastp_002.xml', encoding='utf-8'); l=h.read(400); print(l)"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character '\xe4' in position 313: ordinal not in range(128)
```

So, yes, we should look at opening BLAST XML files (etc?) with a default encoding - but fixing that is likely to expose problems elsewhere in the tests (like the print statement in this trivial test case).

We will probably have to define our own function ``open_with_encoding`` or similar in our Python 2/3 compatibility layer ``Bio._py3k`` to do this as cleanly as possible to support Python 2.7 where the ``open`` function does not expect an encoding argument.

Resolving patch:
diff --git a/Bio/Blast/NCBIXML.py b/Bio/Blast/NCBIXML.py
--- a/Bio/Blast/NCBIXML.py
+++ b/Bio/Blast/NCBIXML.py
@@ -579,9 +579,17 @@ def parse(handle, debug=0):
     BLOCK = 1024
     MARGIN = 10  # must be at least length of newline + XML start
     XML_START = "<?xml"
+    NEW_LINE = "\n"
+    NULL = ""
 
-    text = handle.read(BLOCK)
     pending = ""
+    text = handle.read(BLOCK)
+    if isinstance(text, bytes):
+        # Not a text handle, raw bytes mode
+        XML_START = b"<?xml"
+        NEW_LINE = b"\n"
+        NULL = b""
+        pending = b""
 
     if not text:
         # NO DATA FOUND!
@@ -590,9 +598,9 @@ def parse(handle, debug=0):
     while text:
         # We are now starting a new XML file
         if not text.startswith(XML_START):
-            raise ValueError("Your XML file did not start with %s... "
-                             "but instead %s"
-                             % (XML_START, repr(text[:20])))
+            raise ValueError("Your XML file did not start with %b... "
+                             "but instead %b"
+                             % (XML_START, text[:20]))
 
         expat_parser = expat.ParserCreate()
         blast_parser = BlastParser(debug)
@@ -611,14 +619,14 @@ def parse(handle, debug=0):
             text, pending = pending + handle.read(BLOCK), ""
             if not text:
                 # End of the file!
-                expat_parser.Parse("", True)  # End of XML record
+                expat_parser.Parse(NULL, True)  # End of XML record
                 break
 
             # Now read a little bit more so we can check for the
             # start of another XML file...
             pending = handle.read(MARGIN)
 
-            if ("\n" + XML_START) not in (text + pending):
+            if (NEW_LINE + XML_START) not in (text + pending):
                 # Good - still dealing with the same XML file
                 expat_parser.Parse(text, False)
                 while blast_parser._records:
@@ -628,7 +636,7 @@ def parse(handle, debug=0):
                 # one XML file for each query!
 
                 # Finish the old file:
-                text, pending = (text + pending).split("\n" + XML_START, 1)
+                text, pending = (text + pending).split(NEW_LINE + XML_START, 1)
                 pending = XML_START + pending
 
                 expat_parser.Parse(text, True)  # End of XML record
@@ -637,7 +645,7 @@ def parse(handle, debug=0):
 
                 # Now we are going to re-loop, reset the
                 # parsers and start reading the next XML file
-                text, pending = pending, ""
+                text, pending = pending, NULL
                 break
 
         # this was added because it seems that the Jython expat parser
@@ -648,10 +656,10 @@ def parse(handle, debug=0):
         # At this point we have finished the first XML record.
         # If the file is from an old version of blast, it may
         # contain more XML records (check if text=="").
-        assert pending == ""
-        assert len(blast_parser._records) == 0
+        assert not pending, pending
+        assert len(blast_parser._records) == 0, len(blast_parser._records)
 
     # We should have finished the file!
-    assert text == ""
-    assert pending == ""
-    assert len(blast_parser._records) == 0
+    assert not text, text
+    assert not pending, pending
+    assert len(blast_parser._records) == 0, len(blast_parser._records)
diff --git a/Bio/SeqIO/__init__.py b/Bio/SeqIO/__init__.py
--- a/Bio/SeqIO/__init__.py
+++ b/Bio/SeqIO/__init__.py
@@ -442,7 +442,7 @@
                    "seqxml": SeqXmlIO.SeqXmlWriter,
                    }
 
-_BinaryFormats = ["sff", "sff-trim", "abi", "abi-trim"]
+_BinaryFormats = ["sff", "sff-trim", "abi", "abi-trim", "seqxml"]
 
 
 def write(sequences, handle, format):


Test patch:
diff --git a/Tests/test_NCBIXML.py b/Tests/test_NCBIXML.py
--- a/Tests/test_NCBIXML.py
+++ b/Tests/test_NCBIXML.py
@@ -17,7 +17,7 @@ def test_xml_2212L_blastp_001(self):
 
         filename = 'xml_2212L_blastp_001.xml'
         datafile = os.path.join("Blast", filename)
-        handle = open(datafile)
+        handle = open(datafile, "rb")
         records = NCBIXML.parse(handle)
         record = next(records)
 
@@ -1393,7 +1393,7 @@ def test_xml_2212L_blastp_001(self):
         self.assertRaises(StopIteration, next, records)
         handle.close()
 
-        handle = open(datafile)
+        handle = open(datafile, "rb")
         record = NCBIXML.read(handle)
         handle.close()
 
@@ -1402,7 +1402,7 @@ def test_xml_2212L_blastn_001(self):
 
         filename = 'xml_2212L_blastn_001.xml'
         datafile = os.path.join("Blast", filename)
-        handle = open(datafile)
+        handle = open(datafile, "rb")
         records = NCBIXML.parse(handle)
         record = next(records)
         alignments = record.alignments
@@ -1422,7 +1422,7 @@ def test_xml_2212L_blastn_001(self):
         self.assertRaises(StopIteration, next, records)
         handle.close()
 
-        handle = open(datafile)
+        handle = open(datafile, "rb")
         record = NCBIXML.read(handle)
         handle.close()
 
@@ -1432,7 +1432,7 @@ def test_xml_2212L_blastx_001(self):
         filename = 'xml_2212L_blastx_001.xml'
         datafile = os.path.join("Blast", filename)
 
-        handle = open(datafile)
+        handle = open(datafile, "rb")
         records = NCBIXML.parse(handle)
         record = next(records)
         alignments = record.alignments
@@ -1442,7 +1442,7 @@ def test_xml_2212L_blastx_001(self):
         self.assertRaises(StopIteration, next, records)
         handle.close()
 
-        handle = open(datafile)
+        handle = open(datafile, "rb")
         record = NCBIXML.read(handle)
         handle.close()
 
@@ -1452,7 +1452,7 @@ def test_xml_2212L_tblastn_001(self):
         filename = 'xml_2212L_tblastn_001.xml'
         datafile = os.path.join("Blast", filename)
 
-        handle = open(datafile)
+        handle = open(datafile, "rb")
         records = NCBIXML.parse(handle)
         record = next(records)
         alignments = record.alignments
@@ -1462,7 +1462,7 @@ def test_xml_2212L_tblastn_001(self):
         self.assertRaises(StopIteration, next, records)
         handle.close()
 
-        handle = open(datafile)
+        handle = open(datafile, "rb")
         record = NCBIXML.read(handle)
         handle.close()
 
@@ -1472,7 +1472,7 @@ def test_xml_2212L_tblastx_001(self):
         filename = 'xml_2212L_tblastx_001.xml'
         datafile = os.path.join("Blast", filename)
 
-        handle = open(datafile)
+        handle = open(datafile, "rb")
         records = NCBIXML.parse(handle)
         record = next(records)
         alignments = record.alignments
@@ -1482,7 +1482,7 @@ def test_xml_2212L_tblastx_001(self):
         self.assertRaises(StopIteration, next, records)
         handle.close()
 
-        handle = open(datafile)
+        handle = open(datafile, "rb")
         record = NCBIXML.read(handle)
         handle.close()
 
@@ -1493,7 +1493,7 @@ def test_xml_2218_blastp_001(self):
         filename = 'xml_2218_blastp_001.xml'
         datafile = os.path.join("Blast", filename)
 
-        handle = open(datafile)
+        handle = open(datafile, "rb")
         records = NCBIXML.parse(handle)
 
         record = next(records)
@@ -1549,7 +1549,7 @@ def test_xml_2218_blastp_001(self):
         self.assertRaises(StopIteration, next, records)
         handle.close()
 
-        handle = open(datafile)
+        handle = open(datafile, "rb")
         record = NCBIXML.read(handle)
         handle.close()
 
@@ -1558,7 +1558,7 @@ def test_xml_2218_blastp_002(self):
 
         filename = 'xml_2218_blastp_002.xml'
         datafile = os.path.join("Blast", filename)
-        handle = open(datafile)
+        handle = open(datafile, "rb")
         records = NCBIXML.parse(handle)
         record = next(records)
         self.assertEqual(record.query_id, "gi|585505|sp|Q08386|MOPB_RHOCA")
@@ -1576,7 +1576,7 @@ def test_xml_2218L_blastp_001(self):
         filename = 'xml_2218L_blastp_001.xml'
         datafile = os.path.join("Blast", filename)
 
-        handle = open(datafile)
+        handle = open(datafile, "rb")
         records = NCBIXML.parse(handle)
         record = next(records)
         self.assertEqual(record.query_id, "lcl|1_0")
@@ -1585,7 +1585,7 @@ def test_xml_2218L_blastp_001(self):
         self.assertRaises(StopIteration, next, records)
         handle.close()
 
-        handle = open(datafile)
+        handle = open(datafile, "rb")
         record = NCBIXML.read(handle)
         handle.close()
 
@@ -1596,7 +1596,7 @@ def test_xml_2222_blastx_001(self):
         filename = 'xml_2222_blastx_001.xml'
         datafile = os.path.join("Blast", filename)
 
-        handle = open(datafile)
+        handle = open(datafile, "rb")
         records = NCBIXML.parse(handle)
 
         record = next(records)
@@ -1720,7 +1720,7 @@ def test_xml_2222_blastp_001(self):
         filename = 'xml_2222_blastp_001.xml'
         datafile = os.path.join("Blast", filename)
 
-        handle = open(datafile)
+        handle = open(datafile, "rb")
         records = NCBIXML.parse(handle)
 
         record = next(records)
@@ -1763,7 +1763,7 @@ def test_xml_2218L_rpsblast_001(self):
         filename = 'xml_2218L_rpsblast_001.xml'
         datafile = os.path.join("Blast", filename)
 
-        handle = open(datafile)
+        handle = open(datafile, "rb")
         records = NCBIXML.parse(handle)
 
         record = next(records)