question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug: adding zero notes causes crash

See original GitHub issue

If 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:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
lervagcommented, Jun 7, 2020

Thanks! I added a similar check for the n_notes attribute. In principle, I think there might still be a slight bug here, since the empty.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.

1reaction
lervagcommented, Jun 7, 2020

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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found