bxlab / bx-python

Tools for manipulating biological data, particularly multiple sequence alignments
MIT License
145 stars 53 forks source link

Incompatible types str and byte under python3 #49

Closed adthrasher closed 4 years ago

adthrasher commented 4 years ago

The following line causes an error when running on Python3. Setting the encoding on the 0 byte string seems to fix the problem.

https://github.com/bxlab/bx-python/blob/f0d2c3e762f64961f0cb931b5300d4ea2bcaa03d/lib/bx/bbi/bpt_file.pyx#L74

Suggested change:

- key += ( '\0' * ( self.key_size - len(key) ) ) + key += ( '\0'.encode('utf-8') * ( self.key_size - len(key) ) )

adthrasher commented 4 years ago

Thanks for the quick fix!