ntopaz / characterize_neisseria_capsule

Python script to characterize the Neisseria capsule and predict serogroup for Neisseria meningitidis
6 stars 2 forks source link

Issue with request #4

Open davidmaimoun opened 2 months ago

davidmaimoun commented 2 months ago

Hello,

I use the great scrip, and it help me a lot. It works very well most of the time, but sometime, I got this error:

Step 2. Parsing BLAST results
Parsing BLAST data to identify alleles to extract from pubMLST
Grabbing allele information from pubMLST for 116 alleles
Traceback (most recent call last):
  File "/home/user1/Desktop/analysis/genome_analysis/dev/bin/characterize_neisseria_capsule.py", line 967, in <module>
    main()
  File "/home/user1/Desktop/analysis/genome_analysis/dev/bin/characterize_neisseria_capsule.py", line 948, in main
    final_results_dict=analyze_results(results_dict,args["threads"])
  File "/home/user1/Desktop/analysis/genome_analysis/dev/bin/characterize_neisseria_capsule.py", line 505, in analyze_results
    request_data = json.loads(request.data.decode('utf-8'))                 
  File "/home/user1/miniconda3/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/home/user1/miniconda3/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/home/user1/miniconda3/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Somehow the request doesn't work

I'd glad to get some help

Thank you

kjolley commented 2 months ago

I don't think there is any error checking on the API call in this script so if the PubMLST API responds with anything other than valid JSON then it will crash. Note that there is rate-limiting on the API that limits you to 4 connections - if you were running these in parallel and make more than 4 concurrent connections then you could get a 429 (Too many requests) error response with no JSON, possibly leading to the above problem.

davidmaimoun commented 2 months ago

Thank you for your precious help. The script run on Nextflow but the process of the Serogrouping in not supposed to work in parallele with the other process Typing (for fetching MLST etc). But it is very possible I made a mistake when coding this part of the code I'm going to do my investigation.

Thanks a lot!

Best,

David Maimoun


De : Keith Jolley @.> Envoyé : lundi 22 juillet 2024 11:09 À : ntopaz/characterize_neisseria_capsule @.> Cc : davidmaimoun @.>; Author @.> Objet : Re: [ntopaz/characterize_neisseria_capsule] Issue with request (Issue #4)

I don't think there is any error checking on the API call in this script so if the PubMLST API responds with anything other than valid JSON then it will crash. Note that there is rate-limiting on the API that limits you to 4 connections - if you were running these in parallel and make more than 4 concurrent connections then you could get a 429 (Too many requests) error response with no JSON, possibly leading to the above problem.

— Reply to this email directly, view it on GitHubhttps://github.com/ntopaz/characterize_neisseria_capsule/issues/4#issuecomment-2242346390, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHN3VTIY2U2TVNOE5ODBHDDZNS43ZAVCNFSM6AAAAABLG3ANH2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBSGM2DMMZZGA. You are receiving this because you authored the thread.Message ID: @.***>