[tw5] Re: Importing a tiddler written with python?

2020-08-30 Thread amreus
Just a suggestion: I wouldn't build the json string manually. I would use a python dict and add the key/value pairs, then let the JSON library serialize it as a json string. It's the same idea I use only in Ruby for converting my gedcom files to tiddlers. On Thursday, August 27, 2020 at

Re: [tw5] Re: Importing a tiddler written with python?

2020-08-28 Thread Jimmy Sweeney
Thanks Mark! Adding those things to my TODO. This is literally my first ever program that I wrote on my own. So this little script is the equivalent of that first wobbly table that a kid makes in woodworking. I’m just happy that it works! I actually noticed that there are some not-so-obscure

Re: [tw5] Re: Importing a tiddler written with python?

2020-08-28 Thread 'Mark S.' via TiddlyWiki
Nice Work! It's been a long time since using Python, but it was one of my favorite languages. Comments Since python has a library for everything, I'm thinking they must have a library for JSON. This way you don't have to build your own strings, which is subject to error (as you

Re: [tw5] Re: Importing a tiddler written with python?

2020-08-28 Thread Jimmy Sweeney
Thanks all! I figured it out! Mark - you were correct. I needed to get rid of any line breaks so that the resulting file was all just one line. If anyone else wants to use my program, here it is: https://github.com/sweenejp/files/blob/master/isbn_to_json_for_tiddlywiki.py and an example of an

[tw5] Re: Importing a tiddler written with python?

2020-08-27 Thread TW Tones
FYI: Someone has already done an ISBN tiddler, Not sure where, sorry. Tones On Friday, 28 August 2020 06:24:38 UTC+10, Jimmy Sweeney wrote: > > Hi there, > > Would anyone have any clues why this file >

Re: [tw5] Re: Importing a tiddler written with python?

2020-08-27 Thread 'Mark S.' via TiddlyWiki
On Thursday, August 27, 2020 at 2:24:59 PM UTC-7, Jimmy Sweeney wrote: > > Hi Saq - why would that be? When I export other tiddlers as json files > they have line breaks as "\n". > > I don't think they have line breaks in the middle of text strings, as yours does. Wherever there was a line

Re: [tw5] Re: Importing a tiddler written with python?

2020-08-27 Thread dieg...@gmail.com
Hi, When I take that raw string, save it as a .json file and upload that to tiddlywiki.com I can see the imported tiddler just fine! On Thursday, August 27, 2020 at 4:24:59 PM UTC-5 swee...@gmail.com wrote: > Hi Saq - why would that be? When I export other tiddlers as json files > they have

Re: [tw5] Re: Importing a tiddler written with python?

2020-08-27 Thread Jimmy Sweeney
Hi Saq - why would that be? When I export other tiddlers as json files they have line breaks as "\n". Thanks Eric, I fixed those two things but still no luck.

[tw5] Re: Importing a tiddler written with python?

2020-08-27 Thread Saq Imtiaz
Make sure the text field in the JSON does not contain linebreaks or other characters that need to be escaped. On Thursday, August 27, 2020 at 10:24:38 PM UTC+2 swee...@gmail.com wrote: > Hi there, > > Would anyone have any clues why this file >

[tw5] Re: Importing a tiddler written with python?

2020-08-27 Thread Eric Shulman
On Thursday, August 27, 2020 at 1:24:38 PM UTC-7, Jimmy Sweeney wrote: > > Would anyone have any clues why this file > > > isn't importing nice