TypeError: a bytes-like object is required, not 'str'

72 views
Skip to first unread message

Bei Gao

unread,
Oct 4, 2018, 2:01:02 PM10/4/18
to kneaddata users
Hi,

I just installed kneaddata and ran the demo data successfully. However when I run the following command on my own data, a error message occurred. Thanks a lot for the help!

kneaddata --input Data/RawFastQ/10-003-P1_S1_R1_001.fastq --input Data/RawFastQ/10-003-P1_S1_R2_001.fastq -db HumanGenomeDatabase/Homo_sapiens --output kneaddata_output_10

Below is the standard error:

Traceback (most recent call last):
  File "/home/wintergb/.local/bin/kneaddata", line 11, in <module>
    sys.exit(main())
  File "/home/wintergb/.local/lib/python3.5/site-packages/kneaddata/knead_data.py", line 427, in main
    args.input[index]=utilities.get_reformatted_identifiers(args.input[index],args.output_dir, temp_output_files)
  File "/home/wintergb/.local/lib/python3.5/site-packages/kneaddata/utilities.py", line 258, in get_reformatted_identifiers
    os.write(file_out, "".join(lines))
TypeError: a bytes-like object is required, not 'str'


Below is the log file:

10/04/2018 10:37:59 AM - kneaddata.knead_data - INFO: Running kneaddata v0.6.1
10/04/2018 10:37:59 AM - kneaddata.knead_data - INFO: Output files will be written to: /share/fiehnlab/users/bgao/kneaddata_output_10
10/04/2018 10:37:59 AM - kneaddata.knead_data - DEBUG: Running with the following arguments:
trimmomatic_quality_scores = -phred33
log_level = DEBUG
fastqc_path = None
serial = False
trimmomatic_path = /software/trimmomatic/0.33/static/trimmomatic-0.33.jar
pm = 80
bowtie2_path = /software/bowtie2/2.3.4.1/lssc0-linux/bowtie2
trimmomatic_options = None
reference_db = /share/fiehnlab/users/bgao/HumanGenomeDatabase/Homo_sapiens
threads = 1
pi = 10
bowtie2_options = --very-sensitive --phred33
bmtagger = False
output_prefix = 10-003-P1_S1_R1_001_kneaddata
no_discordant = False
log = /share/fiehnlab/users/bgao/kneaddata_output_10/10-003-P1_S1_R1_001_kneaddata.log
trf_path = None
trf = False
minscore = 50
bypass_trim = False
remove_temp_output = True
delta = 7
output_dir = /share/fiehnlab/users/bgao/kneaddata_output_10
verbose = False
maxperiod = 500
cat_final_output = False
cat_pairs = False
input = /share/fiehnlab/users/bgao/Data/RawFastQ/10-003-P1_S1_R1_001.fastq /share/fiehnlab/users/bgao/Data/RawFastQ/10-003-P1_S1_R2_001.fastq
fastqc_end = False
mismatch = 7
reorder = False
match = 2
remove_intermediate_output = False
processes = 1
max_memory = 500m
store_temp_output = False
bmtagger_path = None
fastqc_start = False

10/04/2018 10:37:59 AM - kneaddata.utilities - INFO: Reformatting file sequence identifiers ...


Drishti Kaul

unread,
Oct 4, 2018, 2:57:03 PM10/4/18
to kneaddata users
I think it has to do with the version of python you're using, it messes up with v3.5 and above. What version are you using?

Bei Gao

unread,
Oct 4, 2018, 3:49:19 PM10/4/18
to kneaddata users
Thanks, Drishti! 
When I typed in python -V in my home directory, it showed Python 2.7.12.
However, the server I am using has different versions installed, including python 2, python 2.7, python 3.5 and python 3.5m. I didn't specify any version when I ran the above commands. 


Bei Gao

unread,
Oct 4, 2018, 3:57:41 PM10/4/18
to kneaddata users
Oh, when I typed in python3 -V in my home directory, it showed Python 3.5.2. I am confused which one I was using...LOL
Reply all
Reply to author
Forward
0 new messages