kengruven / strukt-bugs

Bug reports and feature requests for Strukt
6 stars 0 forks source link

Write File does not work [better logging] #14

Closed AddictArts closed 7 years ago

AddictArts commented 7 years ago

I authorized the folder and it does not write a file and I don't have the little red circle saying the app does not have permission.

kengruven commented 7 years ago

What does your pipeline look like? What did you do, exactly?

I'm sorry it's not working for you, but I can't troubleshoot "does not work".

AddictArts commented 7 years ago

Load url http://.... // this shows the json in tab view write file foo.json // this does not work

kengruven commented 7 years ago

Hmm, not much to go on, but here's a brain dump of all the things I could think of:

Did you click the Run button? (Strukt never performs a destructive operation automatically -- see the "Auto-run" section of the manual for details.) Do you see the output disappear, and the status bar (time/#cards) update itself?

After you run the pipeline, does the file "foo.json.partial" exist? (Strukt writes to a temporary file first, so that file updates are atomic.)

Does the file (foo.json) already exist before you run the pipeline? Do you have permissions as a user to write to files in that folder, outside of Strukt?

If you open Console.app, are there any messages about Strukt.app that seem relevant? I expect there to be at least one ("couldn't trash old file", if it's a new file), but any others you see might be helpful.

kengruven commented 7 years ago

BTW, writing out this list caused me to realize a way it could fail. It doesn't sound like what you're running into, but I'm fixing it anyway!

AddictArts commented 7 years ago

Yes I used the run button. There was no partial file or json file. Yes I see the output disappear which is another thing that I really don't want. I want to see the file. No foo.json does not exist and the app should pop up overwrite or something in that case, at least a notification. Ok I ran console and looked and this time I think I found the issue. I forgot the "~". Now it worked.

It should really let the user know why it failed for example permission etc and the path it tried to use. Thanks

kengruven commented 7 years ago

It's strange that it worked without the correct path. For example, if I intend to write to ~/Downloads/foo.txt, but type /Downloads/foo.txt by mistake, I get a permissions warning.

Of course, if it's a different path, but you've also authorized that folder, it won't show a warning, because presumably it would succeed in that case.

I'm going to give some more thought to error handling. I've been designing a logging system, and I think that could be a good place to surface this information.

Thanks for the new-user feedback. It is much appreciated.

kengruven commented 7 years ago

FYI, I've made a minor improvement for the next version of Strukt (ETA later this week): the "Write to File" operation will return as output the values that it writes to disk, in the format that it wrote them.

A proper logging system is also still in the works.

kengruven commented 7 years ago

It took far longer than I anticipated, but there is now (in 1.3, on its way) a proper logging system which will pop open and warn you if you try to Write data but use the wrong field (or several other things that can go wrong):

warning

One of the premises of Strukt is that it should be possible to make 'mistakes', because this also leads to freedom to use the tool in ways it wasn't designed for. The flip side of this is that the tool needs to be more responsible for anticipating and highlighting problems (real or imagined) in order to help guide the user. Logging is one means by which it can do that -- but it's not the first, and certainly won't be the last!