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

JSONDecodeError during Custom Formats Import in Profilarr #19

Closed
santiagosayshey opened this issue Feb 2, 2024 · 2 comments
Closed

Comments

@santiagosayshey
Copy link
Collaborator

santiagosayshey commented Feb 2, 2024

Description:
The issue involves a JSONDecodeError encountered during the attempt to import custom formats using Profilarr. The user was employing Profilarr to enhance the *arr suite with import/export/sync functionalities, specifically trying to import a set titled "Custom Formats (Sonarr).json" for all files. This operation resulted in a failure, indicated by a JSONDecodeError, suggesting a problem with JSON file parsing or response handling. The error appeared after integrating Sonarr into the user's setup, raising questions about compatibility with Sonarr version 4 or an unforeseen bug in Profilarr.

Environment:

  • Operating System: Windows 10
  • Radarr/Sonarr Version: Sonarr v4.0.1.929 and
  • Profilarr Version: Downloaded on the previous day (no specific version provided)

Profile Used (if applicable):

  • Profile Name: Not applicable (attempted import of "Custom Formats (Sonarr).json" for all files)

Steps to Reproduce:

  1. Execute python importarr.py via command line.
  2. Select 'all' when prompted for files to import.
  3. JSONDecodeError occurs during the import process.

Expected Behavior:
The expected outcome was the successful importation of custom formats into Profilarr, facilitating their synchronization with the user's Sonarr and Radarr installations.

Actual Behavior:
The process failed, triggering a JSONDecodeError: Expecting value: line 1 column 1 (char 0), which indicates a parsing issue with JSON data. This error prevented the successful import of custom formats.

Screenshots/Logs:
Screenshots or logs are not available. The error presented is as follows:

1080p Balanced (Radarr).json
1080p Balanced (Single Grab) (Radarr).json
1080p h265 Balanced (Radarr).json
1080p h265 Balanced (Single Grab) (Radarr).json
1080p Optimal (Radarr).json
1080p Optimal (Single Grab) (Radarr).json
1080p Transparent (Double Grab) (Radarr).json
1080p Transparent (Radarr).json
1080p Transparent (Single Grab) (Radarr).json
2160p Optimal (Radarr).json
2160p Optimal (Single Grab) (Radarr).json
Select a file to import (or 'all' for all files): 5

Traceback (most recent call last):
  File "C:\Users\5820K\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\5820K\AppData\Local\Programs\Python\Python311\Lib\json_init_.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\5820K\AppData\Local\Programs\Python\Python311\Lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\5820K\AppData\Local\Programs\Python\Python311\Lib\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)

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "C:\Users\5820K\Downloads\Profilarr-0.2.3\Profilarr-0.2.3\importarr.py", line 265, in <module>
    import_quality_profiles(source_config, './profiles', selected_files)
  File "C:\Users\5820K\Downloads\Profilarr-0.2.3\Profilarr-0.2.3\importarr.py", line 172, in import_quality_profiles
    cf_import_sync(source_config)
  File "C:\Users\5820K\Downloads\Profilarr-0.2.3\Profilarr-0.2.3\importarr.py", line 237, in cf_import_sync
    data = response.json()
           ^^^^^^^^^^^^^^^
  File "C:\Users\5820K\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

C:\Users\5820K\Downloads\Profilarr-0.2.3\Profilarr-0.2.3>
Custom Formats (Sonarr).json
Select a file to import (or 'all' for all files): all

Traceback (most recent call last):
  File "C:\Users\5820K\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\5820K\AppData\Local\Programs\Python\Python311\Lib\json_init_.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\5820K\AppData\Local\Programs\Python\Python311\Lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\5820K\AppData\Local\Programs\Python\Python311\Lib\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)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\5820K\Downloads\Profilarr-0.2.3\Profilarr-0.2.3\importarr.py", line 261, in <module>
    import_custom_formats(source_config, './custom_formats', selected_files)
  File "C:\Users\5820K\Downloads\Profilarr-0.2.3\Profilarr-0.2.3\importarr.py", line 118, in import_custom_formats
    existing_formats = response.json()
                       ^^^^^^^^^^^^^^^
  File "C:\Users\5820K\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Additional Context:
Profilarr was operated on a Windows 10 system, with Sonarr running in Docker on Unraid. While Radarr instances have been functioning without issue, the inclusion of Sonarr has led to complications during the import process with Profilarr. The problem may be associated with Sonarr v4 compatibility or a specific JSON parsing bug within Profilarr.

Also mentioned in Issue #3

@santiagosayshey
Copy link
Collaborator Author

santiagosayshey commented Feb 2, 2024

Will add a try catch clause to output the json when a decode error occurs

@santiagosayshey
Copy link
Collaborator Author

This is maybe fixed with PR #27. Will have to get some feedback from affected users before closing issue

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

1 participant