mfuentesg/SyncSettings

Sync Setting: Download error no json object could be decoded

bfrontend opened this issue · 8 comments

Traceback (most recent call last):
File "C:\Users\17625\AppData\Roaming\Sublime Text 3\Installed Packages\Sync Settings.sublime-package\sync_settings/commands/download.py", line 50, in download
manager.get_content(path.join(self.temp_folder, path.encode('Package Control.sublime-settings')))
File "./python3.3/json/init.py", line 316, in loads
File "./python3.3/json/decoder.py", line 351, in decode
File "./python3.3/json/decoder.py", line 369, in raw_decode
ValueError: No JSON object could be decoded

I'm also seeing this issue, on Windows 10 Enterprise. Hope to see a fix soon!

i was able to reproduce the issue, deleting Package Control.sublime-settings file from my personal gist.

i am not sure why you are ignoring that file, because the idea is synchronize your installed packages between multiple machines.

I still have this issue.

Steps:

  1. Mac: Install Sublime Text and Sync Settings plugin
  2. Mac: Customise it
  3. Mac: Save settings to gist using plugin
  4. Win: Install Sublime Text and Sync Settings plugin
  5. Win: Configure Sync Settings
  6. Win: Download settings

And that's when I get an error

image

And this is the gist created by the plugin: https://gist.github.com/dialex/06912984f5d0269351a0fb65f7d94015

@dialex i tried with your gist, but i didn't faced the issue, are you sure that you have the latest version of SyncSettings?

Latest version v3.2.0

image

Yup, that's the version I have. I'm not sure what else I can do differently :/
Does it help to share the logs?

ERROR:Sync Settings.sync_settings.libs.logger:No JSON object could be decoded
Traceback (most recent call last):
  File "./python3.3/json/decoder.py", line 367, in raw_decode
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\diale\AppData\Roaming\Sublime Text 3\Installed Packages\Sync Settings.sublime-package\sync_settings/commands/download.py", line 52, in download
    package_settings = file.encode_json('{}' if file_content == '' else file_content)
  File "C:\Users\diale\AppData\Roaming\Sublime Text 3\Installed Packages\Sync Settings.sublime-package\sync_settings/libs/file.py", line 16, in encode_json
    return json.loads(re.sub(re.compile(r"(?:(?:^\s*)|\s+)//.*$", re.MULTILINE), "", decoded))
  File "./python3.3/json/__init__.py", line 316, in loads
  File "./python3.3/json/decoder.py", line 351, in decode
  File "./python3.3/json/decoder.py", line 369, in raw_decode
ValueError: No JSON object could be decoded
ERROR:Sync Settings.sync_settings.libs.logger:No JSON object could be decoded
Traceback (most recent call last):
  File "./python3.3/json/decoder.py", line 367, in raw_decode
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\diale\AppData\Roaming\Sublime Text 3\Installed Packages\Sync Settings.sublime-package\sync_settings/commands/download.py", line 52, in download
    package_settings = file.encode_json('{}' if file_content == '' else file_content)
  File "C:\Users\diale\AppData\Roaming\Sublime Text 3\Installed Packages\Sync Settings.sublime-package\sync_settings/libs/file.py", line 16, in encode_json
    return json.loads(re.sub(re.compile(r"(?:(?:^\s*)|\s+)//.*$", re.MULTILINE), "", decoded))
  File "./python3.3/json/__init__.py", line 316, in loads
  File "./python3.3/json/decoder.py", line 351, in decode
  File "./python3.3/json/decoder.py", line 369, in raw_decode
ValueError: No JSON object could be decoded
ERROR:Sync Settings.sync_settings.libs.logger:No JSON object could be decoded
Traceback (most recent call last):
  File "./python3.3/json/decoder.py", line 367, in raw_decode
StopIteration

@dialex Please try reinstalling Sync Settings, checking the error log, it is complaining about the line 16 with the following content return json.loads(re.sub(re.compile(r"(?:(?:^\s*)|\s+)//.*$", re.MULTILINE), "", decoded))
But, checking the code that line has another code, so please, reinstall Sync Settings and let me know if you are still facing the same issue.

trailing_object_commas_re = re.compile(
r'(,)\s*}(?=([^"\\]*(\\.|"([^"\\]*\\.)*[^"\\]*"))*[^"]*$)')
trailing_array_commas_re = re.compile(
r'(,)\s*\](?=([^"\\]*(\\.|"([^"\\]*\\.)*[^"\\]*"))*[^"]*$)')
decoded = re.sub(re.compile(r"/\*.*?\*/", re.DOTALL), "", content)
decoded = trailing_array_commas_re.sub("]", decoded)
decoded = trailing_object_commas_re.sub("}", decoded)
return json.loads(re.sub(re.compile(r"(?:(?:^\s*)|\s+)//.*$", re.MULTILINE), "", decoded))

Reinstalling Sync Settings solved the issue. Thank you for your help :)

@dialex Nice to read it. Enjoy SyncSettings