Skip to content

Conversation

@xrobin
Copy link

@xrobin xrobin commented Oct 8, 2025

(Reopening #8 as a new PR as it was closed following moving around branches)

I have been seeing the following (non reproducible) error message from time to time with the fasta.py script:

Traceback (most recent call last):
  File "fasta.py", line 848, in <module>
    getResult(jobId)
  File "fasta.py", line 471, in getResult
    clientPoll(jobId)
  File "fasta.py", line 455, in clientPoll
    result = serviceGetStatus(jobId)
  File "fasta.py", line 382, in serviceGetStatus
    printDebugMessage(u'serviceGetStatus', u'status: ' + status, 2)
TypeError: must be str, not bytes

The restRequest function returns a str when the request succeeds. When the request fails, an additional call to requests.get(url) is performed, and the raw response .content is returned as bytes instead, without conversion.

This PR converts the content to a str also in case of failure.

PS: not sure if returning the error contents is the right thing to do in this context, but that's an other story.

This prevents a TypeError: must be str, not bytes
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

Successfully merging this pull request may close these issues.

1 participant