Unterminated string starting at
See original GitHub issueIm getting a strange error. Im currently using seedcross and get this error with your API. Im unsure of why.
here is the traceback.
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/qbittorrentapi/decorators.py", line 161, in wrapper
result = response.json()
File "/root/.local/lib/python3.8/site-packages/requests/models.py", line 910, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/local/lib/python3.8/json/__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.8/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Unterminated string starting at: line 1 column 239700 (char 239699)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/root/.local/lib/python3.8/site-packages/background_task/tasks.py", line 43, in bg_runner
func(*args, **kwargs)
File "/root/seedcross/crseed/tasks.py", line 80, in backgroundCrossSeedTask
iterTorrents(dlclient, param, log)
File "/root/seedcross/crseed/CrossSeedAutoDL.py", line 356, in iterTorrents
torList = dlclient.loadTorrents()
File "/root/seedcross/crseed/torclient.py", line 196, in loadTorrents
torList = self.qbClient.torrents_info()
File "/usr/local/lib/python3.8/site-packages/qbittorrentapi/decorators.py", line 112, in wrapper
return func(client, *args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/qbittorrentapi/decorators.py", line 170, in wrapper
raise APIError("Exception during response parsing. Error: %r" % exc)
qbittorrentapi.exceptions.APIError: Exception during response parsing. Error: JSONDecodeError('Unterminated string starting at: line 1 column 239700 (char 239699)')
Any idea what the cause could be?
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Python & JSON: ValueError: Unterminated string starting at
Python says there is in an unterminated string so I looked at the end of the JSON in the file that fails and...
Read more >Unterminated string starting at: line 1 column 127395 (char ...
Uploading the test add-on (attached), I get the following traceback on validation: "Traceback (most recent call last): File ...
Read more >json.decoder.JSONDecodeError: Unterminated string ... - GitHub
I am using gunicorn + Flask + Docker with async gevent workers. My application receives a request with a json body that contains...
Read more >Incorrect position reported in JSONDecodeError when loading ...
When loading an invalid json that ends in an unterminated string that ... JSONDecodeError: Unterminated string starting at: line 1 column 1 ...
Read more >How to fix an unterminated string literal in Python - Quora
Unterminated string constant means that you are missing the ending quotes of string. Just put the ending quotes and it's done .
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
so i had that script running for over 24 hours and have not seen the issue once.
I also have not replicated the issue with seedcross. I have a feeling that the issue is that when i first run seedcross it overloads the qbittorrent instances as so many new torrents are being added and being rechecked and thats the cause of the Unterminated string since the qbit is so overloaded.
i think its best to close this for now and Ill reopen if i can re-produce.
BTW thanks for the prompt responses and the excellent help.
hmm…interesting. That suggests the problem is likely intermittent…and as such makes it much harder to track down. Additionally, the dictionary for each torrent that is returned from
client.torrents_info()
do not contain much dynamic content other than changing statistics; so, that does make me wonder if special characters could really be the root cause given I wouldn’t expect them to be appearing and disappearing in this payload…Nonetheless, another option is just to run
client.torrents_info()
in an infinite loop:You can change
LOOP_INTERVAL
to have it run as often as you like. And the loops will break out as soon as there’s a problem; so, no need to watch it. The exception will be the last thing printed once one occurs.