mfuentesg / SyncSettings

Sync Settings - The cross-platform solution to keep Sublime Text configuration synchronized
https://mfuentesg.dev/SyncSettings
MIT License
288 stars 38 forks source link

"No JSON object could be decoded" when downloading gists #119

Closed skorasaurus closed 4 years ago

skorasaurus commented 5 years ago

Hi,

Both computers are running Ubuntu 16.04.

I am attempting to download settings from Computer A on Computer B.

On B, I moved my previous sublime-text profile to a separate folder so I could start from scratch.

On B, I opened sublime, installed package manager and Sync Settings; and closed sublime text.

I reopened sublime, created a new gist token for B, copied it into B's syncSettings file; I also copied the gist_id into B's sync settings file.

B's syncsettings file can be found at https://gist.github.com/skorasaurus/3226b2c0458a4b0fa28792f6b1ebbe97#file-b-syncsettings-sublime

It is unclear whether I need to include an access_token on each computer that you plan to sync settings with and whether that access token is the same for each computer. I understand that the gist_id should be each computer's syncsettings.

I restarted sublime again and when I ran Sync Settings Download from Computer B, I received a modal dialog box pop-up:

"No JSON object could be decoded".

Lastly, I should note, in my original gist that I created on computer A, I receive a message at the top of the gist stating: " This gist exceeds the recommended number of files (~10). To access all files, please clone this gist. To share more, create a repository. "

May this be the cause of the problem?

I also included the package-control-sublime-user-settings and sync settings log from computer B.

meetajhu commented 5 years ago

Even i have the same problem. I think the author needs to update for the latest version of sublime. This started happening since i got Sublime Text 3.2 (Build 3200). Version 3.1.1 works just fine.

mfuentesg commented 5 years ago

Hey Guys, i will try to fix it soon.

Btw, you are welcome to contribute and fix the issue, put in practice your knowledge!

earhax commented 5 years ago

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

mfuentesg commented 5 years ago

@earhax can you share with me your gist?

earhax commented 5 years ago

@earhax can you share with me your gist?

Unfortunately, due to security reasons, I can't. I've got some sensitive data that is being syncd. Is there other info I could share that would help?

By the way, at home on my MacBook Pro, the download is working okay. So I am only seeing this issue on Windows 10 on my PC at work.

mfuentesg commented 5 years ago

I have released a new version yesterday. Can you check again in your windows machine. If still failing, can you paste logs here please?

earhax commented 5 years ago

I'm not at work today. But as soon as I'm back I will try the new version and let you know how it goes. Thanks!

earhax commented 5 years ago

I'm not sure if I have automatically updated to the latest SyncSettings version. I closed and restarted ST3 on my PC, and tried downloading again. But it is still giving the same "no JSON" error.

Here is the latest traceback entry from the log. Traceback (most recent call last):

File "C:\Users\Mmaksim\AppData\Roaming\Sublime Text 3\Installed Packages\Sync Settings.sublime-package\sync_settings/commands/download.py file:///C:/Users/Mmaksim/AppData/Roaming/Sublime%20Text%203/Installed%20Packages/Sync%20Settings.sublime-package/sync_settings/commands/download.py ", line 51, 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

mfuentesg commented 5 years ago

Try to upgrade sync settings manually, using the package control upgrade command.

Because line above is the previous version of the plugin.

mfuentesg commented 5 years ago
manager.fetch_files(files, self.temp_folder)
            file_content = manager.get_content(
                path.join(self.temp_folder, path.encode('Package Control.sublime-settings'))
            )
            package_settings = json.loads('{}' if file_content == '' else file_content)
earhax commented 5 years ago

I tried doing an upgrade using "Package Control: Upgrade Package", but I see the response "there are no packages ready for upgrade". Is there some way I can force it to upgrade, or to do it manually without losing my user settings for the package?

Also, looking at the package file "C:\Users\Mmaksim\AppData\Roaming\Sublime Text 3\Installed Packages\Sync Settings.sublime-package" it shows a date modified of 7/10/2019 13:09. So maybe it upgraded, but it still isn't working for me?

mfuentesg commented 5 years ago

Yes, you can clone this repository in the sublime text packages folder. After restar your sublime and try to use download command from the cloned plugin version.

earhax commented 5 years ago

Okay. I've never cloned a repository before, so hopefully I do this correctly. I downloaded a zip of the cloned repository. I guess I just put that in the \AppData\Roaming\Sublime Text 3\Installed Packages folder? Or should it be in the \AppData\Roaming\Sublime Text 3\Packages\User folder? Also, do I need to rename it to something else in order to use the cloned version instead of the one I already have installed?

earhax commented 5 years ago

Okay I think I got it working. I moved the Sync Settings.sublime-package out of the AppData\Roaming\Sublime Text 3\Installed Packages folder to keep a backup of it, then put the zip of the clone in there, renamed it to Sync Settings.sublime-package, restarted ST3, and saw a notification that a dependency was downloaded and to restart the app. After that, I used the Package Control: Upgrade Package command, and saw Sync Settings listed, and upgraded it. I restarted ST3 one more time, then tried the download again. It seemed to take a lot longer while it was running than it normally does when I run the command on my MacBook Pro at home. But I didn't see the "No JSON object" error this time. Also, I'm not sure if anything actually downloaded. Nothing was written to the Sync Settings log file. However, I did see the following printed in the console after the "Sync Settings: downloading files" hourglass disappeared.

Traceback (most recent call last): File "./python3.3/shutil.py", line 523, in move FileNotFoundError: [WinError 2] The system cannot find the file specified: 'C:\Users\mmaksim\AppData\Roaming\Sublime Text 3\Packages\User\Preferences.sublime-settings'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\mmaksim\AppData\Roaming\Sublime Text 3\Installed Packages\Sync Settings.sublime-package\sync_settings/commands/download.py", line 63, in File "C:\Users\mmaksim\AppData\Roaming\Sublime Text 3\Installed Packages\Sync Settings.sublime-package\sync_settings/commands/download.py", line 29, in check_installation File "C:\Users\mmaksim\AppData\Roaming\Sublime Text 3\Installed Packages\Sync Settings.sublime-package\sync_settings/commands/download.py", line 63, in File "C:\Users\mmaksim\AppData\Roaming\Sublime Text 3\Installed Packages\Sync Settings.sublime-package\sync_settings/commands/download.py", line 32, in on_done File "C:\Users\mmaksim\AppData\Roaming\Sublime Text 3\Installed Packages\Sync Settings.sublime-package\sync_settings/sync_manager.py", line 125, in move_files File "./python3.3/shutil.py", line 535, in move File "./python3.3/shutil.py", line 243, in copy2 File "./python3.3/shutil.py", line 109, in copyfile FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\mmaksim\.sync_settings\temp\Preferences.sublime-settings'

mfuentesg commented 5 years ago

@earhax are you ignoring *.sublime-settings files?

earhax commented 5 years ago

@mfuentesg no, I'm not ignoring those files. Here's a copy of my SyncSettings.sublime-settings file with my gist and proxy server info omitted:


{
    // Brings write permission to Sync Settings over your gists (edit, delete and create).
    // This option is not required, if you only want to download your backups
    "access_token": "",

    // Identifier of your backup on gist.github.com.
    "gist_id": "",

    // In simple words, this option is a black list. Which means, every file
    // that match with the defined pattern, will be ignored on sync.
    "excluded_files": [
        "*.dmg",
        "*.DS_Store*",
        "*.exe",
        "*.Spotlight-V100",
        "*.Trashes",
        "*ehthumbs.db",
        "*oscrypto-ca-bundle.crt",
        "*Package Control.cache/*",
        "*Package Control.last-run",
        "*Package Control.merged-ca-bundle",
        "*Package Control.system-ca-bundle",
        "*Package Control.user-ca-bundle",
        "*Thumbs.db"
    ],

    // An HTTP proxy server to use for requests.
    "http_proxy": "",

    // An HTTPS proxy server to use for requests.
    "https_proxy": "",

    // In simple words, this option is a white list. Which means, every file that
    // match with the defined pattern, will be included on sync, even if it was
    // included on `excluded_files` option.
    "included_files": [
        "*.txt"
    ],

    // If is `true`, your settings will be synced with the latest settings on
    // gist.github.com when Sublime Text startup
    "auto_upgrade": false
}
mfuentesg commented 5 years ago

Weird, but i have released a new version yesterday.

earhax commented 5 years ago

Looking in \AppData\Roaming\Sublime Text 3\Installed Packages, I see that Sync Settings.sublime-package shows a date modified of today's date at the time I started sublime text this morning. So I assume I have the most recent version now. I tried downloading again, and am still seeing this in the console after the downloading hourglass disappears. Same behavior as the previous version I tested.


Traceback (most recent call last):
  File "./python3.3/shutil.py", line 523, in move
FileNotFoundError: [WinError 2] The system cannot find the file specified: 'C:\\Users\\Mmaksim\\AppData\\Roaming\\Sublime Text 3\\Packages\\User\\Preferences.sublime-settings'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Mmaksim\AppData\Roaming\Sublime Text 3\Installed Packages\Sync Settings.sublime-package\sync_settings/commands/download.py", line 63, in <lambda>
  File "C:\Users\Mmaksim\AppData\Roaming\Sublime Text 3\Installed Packages\Sync Settings.sublime-package\sync_settings/commands/download.py", line 29, in check_installation
  File "C:\Users\Mmaksim\AppData\Roaming\Sublime Text 3\Installed Packages\Sync Settings.sublime-package\sync_settings/commands/download.py", line 63, in <lambda>
  File "C:\Users\Mmaksim\AppData\Roaming\Sublime Text 3\Installed Packages\Sync Settings.sublime-package\sync_settings/commands/download.py", line 32, in on_done
  File "C:\Users\Mmaksim\AppData\Roaming\Sublime Text 3\Installed Packages\Sync Settings.sublime-package\sync_settings/sync_manager.py", line 125, in move_files
  File "./python3.3/shutil.py", line 535, in move
  File "./python3.3/shutil.py", line 243, in copy2
  File "./python3.3/shutil.py", line 109, in copyfile
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Mmaksim\\.sync_settings\\temp\\Preferences.sublime-settings'
earhax commented 4 years ago

Hey sorry for the lack of response on this. How do I get the latest version?

On Mon, Jun 22, 2020, 8:17 PM Marcelo Fuentes notifications@github.com wrote:

Closed #119 https://github.com/mfuentesg/SyncSettings/issues/119 via

151 https://github.com/mfuentesg/SyncSettings/pull/151.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mfuentesg/SyncSettings/issues/119#event-3469622212, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMCQNZMO4JGUM5EVOTS3W43RX6N5JANCNFSM4HAWORWA .