Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cfz1998 opened this issue Jan 14, 2024 · 3 comments
Open

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

cfz1998 opened this issue Jan 14, 2024 · 3 comments

Comments

@cfz1998
Copy link

cfz1998 commented Jan 14, 2024

Hi @JanaSperschneider !
I'm using ApoplastP for prediction. But I got an error:

python /data/chaofan/software/ApoplastP/Scripts/ApoplastP.py -i ../02.assemble_res/CCA295.pep -o CCA295.apop
-----------------

ApoplastP is running for 14326 proteins given in FASTA file ../02.assemble_res/CCA295.pep

-----------------
Calculate statistics of protein properties
Traceback (most recent call last):
  File "/data/chaofan/software/ApoplastP/Scripts/ApoplastP.py", line 213, in <module>
    main()
  File "/data/chaofan/software/ApoplastP/Scripts/ApoplastP.py", line 171, in main
    out.writelines(functions.short_output(predictions))
TypeError: a bytes-like object is required, not 'str'

How to fix it? Maybe replace "wb" with "w" in the line 165 in ApoplastP.py ?

Thank you for your reply.

@JanaSperschneider
Copy link
Owner

Hi,
can you tell me which version of Python you are using? I just ran ApoplastP under Python 3.x and I don't get the error message.

Can you please run the test command (Testing.fasta is provided with ApoplastP) and see if it works?
python ApoplastP.py -i Testing.fasta

I suspect it is either a problem with the Python version or the input FASTA file.

Thanks a lot!
Jana

@jd3234
Copy link

jd3234 commented Feb 6, 2024

.Hi,
I am also getting the same error. I am using python 3.12.1 and biopython 1.83. I tested with the fasta you provide with ApoplastP.

It works when I run it with command ApoplastP -i path/testing.fasta but not when I specify the -o parameter.

@JanaSperschneider
Copy link
Owner

Thanks for clarifying that the problem occurs only with the -o parameter!
Code is updated now (changed 'wb' to 'w' in line 165).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants