AndersenLab / VCF-kit

VCF-kit: Assorted utilities for the variant call format
http://www.andersenlab.org
MIT License
122 stars 25 forks source link

error while using docker image (andersenlab/vcf-kit:20200822175018b7b60d: TypeError: a bytes-like object is required, not 'str' #39

Open laura-bankers opened 3 years ago

laura-bankers commented 3 years ago

Hello - I am receiving the following error using the latest docker image (andersenlab/vcf-kit:20200822175018b7b60d). Any idea what this means or what I need to do to fix it? Any help you can provide is much appreciated.

Error: Traceback (most recent call last): File "/opt/conda/envs/vcf-kit/lib/python3.7/site-packages/vcfkit/vcf2tsv.py", line 89, in line = line.replace("u'","") # No idea why u' is prefixed... TypeError: a bytes-like object is required, not 'str'

tdido commented 3 years ago

Seems like an encoding problem (also evidenced by the "u" prefix that the developer mentions).

A quick fix would be to decode the string by replacing: line = line.replace("u'","") with line = line.decode().replace("u'","") in the file /opt/conda/envs/vcf-kit/lib/python3.7/site-packages/vcfkit/vcf2tsv.py.

Bear in mind that this change will likely not survive updates to the docker image or conda environment.