Closed DiagonalArg closed 7 years ago
Hi Diagonal,
My wife had our first child, so understandably I won't be able to get to this too quickly. I did look into the error message earlier. I don't think it would be related to URWID. At this location in the code, it is trying to get the ID of the note you created, so it can then use that ID when telling it which note to selected when displaying the main list of notes again.
You are correct that you should just have to :wq to save the note. I don't think you did anything wrong.
Is there anything special about your situation? For example, do you have notes already existing in this SimpleNote account?
I'm not sure where that 'key' is supposed to get set. notes_db.create_note() will create the note object, but it doesn't set a key value at that time.
Did the note get saved to SimpleNote successfully, if you check on the website for it? Were you working online or offline when you made the note? It is likely that the key is given to the note by SimpleNote's API, but I'm not sure.
Congratulations Shawn! :)
I do have two notes in the simplenote account, the "thank you for signing up" note and a test note that I created there. Regardless, I am running using sncli -n
. While I do have the credentials for the simplenote account in the .snclirc, but I'm assuming that the -n
means that whether it's saved or not and the contents of that account is irrelevant. I have only one note visible in the sncli interface, another test note, and since I always run with -n
that is not stored online.
... Ok, so I cleared out the simplenote online account, and ran without -n
. Now it's working.
... I ran again with -n
and it also works!
Odd bug, though....
You go get some sleep now, ok? :)
This is definitely still an issue. Steps to reproduce:
sncli -n
(so it doesn't try syncing)The problem is that before it has synced to the server, there is no "key" key set in the note object. This could probably be fixed with some refactoring or using a "localkey" key as is used in other places.
Update: I can't duplicate the below issue at this time. Chalking it up to possible network connectivity gremlins. Will try to capture the log next time, if this occurs again. Regardless, whether in the case of intermittent/low fidelity connections, or when using -n
forced no-sync mode, there should probably be a graceful degradation mode (e.g., "localkey").
I started experiencing this issue anytime I create a new note with sncli, even when my machine is online and sync is /not/ disabled with the -n
option. (Although, perhaps the "key" creation operations are just timing out due to a slow connection?)
In the past, I have typically created new notes with nvALT and just used sncli to update notes. So, I'm not sure if this error was recently (re)introduced, or if it has always existed in my environment.
Steps to reproduce:
sncli
Traceback (most recent call last): File "./sncli", line 33, insncli.main(sys.argv[1:]) File "/home/myusername/Workspaces/sncli/simplenote_cli/sncli.py", line 1207, in main sncli(sync, verbose, config).gui(key) File "/home/myusername/Workspaces/sncli/simplenote_cli/sncli.py", line 1019, in gui self.sncli_loop.run() File "/usr/local/lib/python3.4/dist-packages/urwid/main_loop.py", line 278, in run self._run() File "/usr/local/lib/python3.4/dist-packages/urwid/main_loop.py", line 376, in _run self.event_loop.run() File "/usr/local/lib/python3.4/dist-packages/urwid/main_loop.py", line 682, in run self._loop() File "/usr/local/lib/python3.4/dist-packages/urwid/main_loop.py", line 719, in _loop self._watch_files[fd]() File "/usr/local/lib/python3.4/dist-packages/urwid/raw_display.py", line 393, in event_loop, callback, self.get_available_raw_input()) File "/usr/local/lib/python3.4/dist-packages/urwid/raw_display.py", line 493, in parse_input callback(processed, processed_codes) File "/usr/local/lib/python3.4/dist-packages/urwid/main_loop.py", line 403, in _update self.process_input(keys) File "/usr/local/lib/python3.4/dist-packages/urwid/main_loop.py", line 503, in process_input k = self._topmost_widget.keypress(self.screen_size, k) File "/home/myusername/Workspaces/sncli/simplenote_cli/sncli.py", line 673, in gui_frame_keypress lb.note_list[lb.focus_position].note['key']) KeyError: 'key'
I've created a new branch (localkeys) to experiment with fixing this issue. The main reason this is happening, is that although a localkey is created to add the note to it's in-memory database, until the note is synced with the server there is no 'key' key in the note data. I'm attempting to add a 'localkey' key to all notes to use internally.
Feel free to test out the localkeys branch, noting that I haven't tested all the functions much yet and shouldn't be considered stable - an error with referencing keys internally could result in notes being lost/overwritten. (use at own risk!)
localkeys is now merged into master, along with another last-minute fix. This should fix any crashes/errors relating to note keys.
Please let me know if you still get errors to do with this.
I'm having an error now on creating my first note. This is on ubuntu 12.04. I set
cfg_editor = vi
(which is vim-tiny). I also installedurwid
withpip install urwid
as discussed in #19. Version now is:When I use "C" to create a note, all seems well util I save the note using
:wq
, which is what I assume I should do when I want to return out of vim into the sncli interface, correct? The error produced (notice the "t" in "traceback" is missing in the output, that's not my copy/paste error) is:Is this another problem with an old version of urwid?