leo_cloud coolness and gotchas

77 views
Skip to first unread message

Rob

unread,
Jun 15, 2018, 11:23:18 AM6/15/18
to leo-editor
Recently, I discovered the excellent and useful plugin, leo_cloud.py (thanks Terry Brown!) My initial interest was to find an easier way to sync myLeoSettings across multiple machines, locations and OS's. I see additional uses for this plugin beyond just the settings files.

First, a potential `gotcha` in case some one else sees something similar. I was getting a series of errors when loading my settings file which contained numerous @leo_cloud nodes. Something to the effect that ('xxx') was not JSON serializable. I don't claim to understand exactly what that means, but after some searching I found the culprit. One of my abbreviations had something like [item1, item2, etc.]. Apparently, the JSON module can't handle this kind of data (set or array or something). After I modified the offending abbreviation, the errors ceased and all is well.

Second, a question (Terry?) The docs provide examples of how to configure the @leo_cloud nodes to connect to local file system locations and to a GitHub repo. It is suggested that other cloud services can be used, like DropBox, but no example is given. It's not obvious what parameters (URL? Credentials?) to use in the case of DropBox or others.

Wondering if anyone else has success using this plugin with other cloud services. If so, how do you set it up?

Rob...

Terry Brown

unread,
Jun 15, 2018, 11:43:39 AM6/15/18
to leo-e...@googlegroups.com
On Fri, 15 Jun 2018 08:23:18 -0700 (PDT)
Rob <lar...@gmail.com> wrote:

> Recently, I discovered the excellent and useful plugin, leo_cloud.py
> (thanks Terry Brown!) My initial interest was to find an easier way
> to sync myLeoSettings across multiple machines, locations and OS's. I
> see additional uses for this plugin beyond just the settings files.
>
> First, a potential `gotcha` in case some one else sees something
> similar. I was getting a series of errors when loading my settings
> file which contained numerous @leo_cloud nodes. Something to the
> effect that ('xxx') was not JSON serializable. I don't claim to
> understand exactly what that means, but after some searching I found
> the culprit. One of my abbreviations had something like [item1,
> item2, etc.]. Apparently, the JSON module can't handle this kind of
> data (set or array or something). After I modified the offending
> abbreviation, the errors ceased and all is well.

You have that pretty much worked out - it saves the subtree, including
unknownAttributes, p.v.u, as JSON. So all the values in p.v.u have to
be something JSON can represent. I forget what it does with things it
can't represent, it may convert sets to lists and dates to strings.

> Second, a question (Terry?) The docs provide examples of how to
> configure the @leo_cloud nodes to connect to local file system
> locations and to a GitHub repo. It is suggested that other cloud
> services can be used, like DropBox, but no example is given. It's not
> obvious what parameters (URL? Credentials?) to use in the case of
> DropBox or others.

What I was thinking was that you'd just use the local file system
location approach, but pointing into a folder that was being sync'ed
by DropBox or whatever.

Cheers -Terry

Rob

unread,
Jun 15, 2018, 12:00:45 PM6/15/18
to leo-editor
That works, but the path is different to the DropBox (or Google Drive) local folders on different machines and OS's. That's not a problem for the leoSettings file, but I can't use that strategy for other use cases I envision.

Also, thanks for the clarification on JSON.

Rob...

Terry Brown

unread,
Jun 15, 2018, 2:34:59 PM6/15/18
to leo-e...@googlegroups.com
On Fri, 15 Jun 2018 09:00:44 -0700 (PDT)
Rob <lar...@gmail.com> wrote:

> That works, but the path is different to the DropBox (or Google
> Drive) local folders on different machines and OS's. That's not a
> problem for the leoSettings file, but I can't use that strategy for
> other use cases I envision.

I had not thought of that. On non-Windows OSes you can usually use
symlinks, like ~/.leo/cloud/dropbox -> /mnt/usr1/home/fred/DropBox or
whatever. So all the leo_cloud nodes would use ~/.leo/cloud/dropbox
but what the link points to could vary by machine. Doesn't work on
Windows though.

I could implement something like

root: ~/DropBox/leo_cloud | D:\scratch\leo_cloud | //incco/share/a/user/fred/DropBox/leo_cloud

(i.e. | separated alternatives) and it could use the first one that
exists according to os.path.exists()

That work?

Cheers -Terry

Rob

unread,
Jun 15, 2018, 6:31:37 PM6/15/18
to leo-editor
On Friday, June 15, 2018 at 2:34:59 PM UTC-4, Terry Brown wrote:
 
I could implement something like

root: ~/DropBox/leo_cloud | D:\scratch\leo_cloud | //incco/share/a/user/fred/DropBox/leo_cloud

(i.e. | separated alternatives) and it could use the first one that
exists according to os.path.exists()

That work?

 Hmm, interesting idea. Seems like that could work. I'd sure like to try it.

Rob...

Matt Wilkie

unread,
Aug 26, 2018, 7:28:25 PM8/26/18
to leo-editor

I had not thought of that.  On non-Windows OSes you can usually use
symlinks, like ~/.leo/cloud/dropbox -> /mnt/usr1/home/fred/DropBox or
whatever.  So all the leo_cloud nodes would use ~/.leo/cloud/dropbox
but what the link points to could vary by machine.  Doesn't work on
Windows though.

NTFS  supports hard- and symbolic-links.  For command line and concise functionality reference see https://ss64.com/nt/mklink.html. My favourite GUI tool for creating and managing them is Link Shell Extension, http://schinagl.priv.at/nt/hardlinkshellext/linkshellextension.html.

Matt
 
Reply all
Reply to author
Forward
0 new messages