Bug: adding zero notes causes crash
See original GitHub issueIf you run apy add
but change your mind and don’t add anything (e.g. straight away pressing :wq
in Vim or Ctrl-X
in Nano), it crashes:
[ckp95@ckp95-laptop anki]$ apy add
reverting to stock json
Dupe detected, note was not added!
Question:
Traceback (most recent call last):
File "/home/ckp95/.local/bin/apy", line 8, in <module>
sys.exit(main())
File "/home/ckp95/.local/lib/python3.8/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/home/ckp95/.local/lib/python3.8/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/home/ckp95/.local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/ckp95/.local/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/ckp95/.local/lib/python3.8/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/home/ckp95/.local/lib/python3.8/site-packages/apy/cli.py", line 75, in add
click.echo(f'Added note to deck: {decks[0]}')
IndexError: list index out of range
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Crash in background on iOS 15 EXC_CRASH (SIGKILL)
We have deployed a fix to the backend services that provide crashes for your app into the Xcode Organizer, so if you receive...
Read more >Detect and diagnose crashes - Android Developers
There are many situations that can cause a crash in your app. Some reasons are obvious, like checking for a null value or...
Read more >The top 6 reasons mobile apps crash: How to best avoid Murphy
Mobile apps can crash for a hundred different reasons. Experts share their thoughts on the primary causes of crashes and how to fix...
Read more >How To Fix The Ticking Entity Crash in Minecraft - YouTube
Learn How To Fix The Ticking Entity Crash in Minecraft with Apex Hosting. Apex Minecraft Hosting: https://apexminecrafthosting.com/24/7 ...
Read more >Frequent Crashes / Endless Crashing - Please Help!
That kind of crash happens about 30% of the time and does not trigger CrashReporter. It is listed in Event Viewer as a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks! I added a similar check for the
n_notes
attribute. In principle, I think there might still be a slight bug here, since theempty.md
note is still parsed and we try to add it. It is detected as a dupe and so no notes are actually added.In any case, I think the point here is not to become perfect. Good is good enough. When I make mistakes, I have found I can still use apy to fix them quite easily with the
apy review
function.I really appreciate your effort, it is very nice to get some help in fixing issues and improving this utility.
apy
is already at 95% fully functional for me, but it might have some rough edges especially with regard to other users workflows and similar. As such, it is very nice to get help in fixing these.Thanks! I’ve copied your cli tests! I was not aware of the
click.testing
module and I very much like the use of the temporary directories for testing as you’ve done here. Again, thanks!Also, I can now reproduce the error and I’ll look into a way to fix it!