[Tutor] Fixing a python curses bug in my program

Bithov Vinu Student vinub at calday.co.uk
Wed Jul 7 06:54:52 EDT 2021


Hi,

I've been trying to write an intelligent flashcard application (similar to
Anki) that is for the command line. The program would, more specifically,
take a CSV file (called a review file) that contained flashcards (field 1
is front, field 2 is the back, 3-5 are metadata filled in by the program),
filter for all cards due today, never-before-seen, or due today and
never-before seen (these "filters" are based on command line arguments).
This filtered deck of cards is prompted to the user by the program using
curses, the user presses any key to reveal the answer, and grades the card
based on its easiness. The program then uses the SuperMemo 2 algorithm (cf.
SuperMemo, Anki, Mnemosyne) and the aformentioned metadata  to calculate
the date at which the flashcard ought to be next reviewed, for optimum
recall of the fact. [Here](https://bit.ly/3hMEFbr) is a heavily commented
version of the code; my problem is not the overall program but rather the
init_curses() function, the prompt_review_card() function , and the quiz
function, which are the only functions that use curses directly. When I run
the program with the correct command line arguments (exemplar usage is
shown in the comments and a test file is attached to this email)  it
abruptly exits and my shell has its formatting changed so that every Enter
results in it tabbing slightly away from me.

How would I fix the curses bug? I'm well aware that at the moment the
overall code is a mess and could do with some serious refactoring (for
which tips and advice is appreciated) but at the moment I'm just looking to
get a functioning prototype working before I make it completely robust.

Thanks,
Bithov Vinu=

=== EXEMPLAR FILE ===
bioch: Why do open chain saccharides have reducing properties? because of
the carbonyl group (which can accept protons)
bioch: Which component of starch is branched? amylopectin 0 2.5 0 0001-01-01
bioch: What stages of the pentose phosphate pathway form the non-oxidative
phase? ribulose 5-phosphate -> fructose 6-phosphate 1 2.6 1 07/07/2021
=== EXEMPLAR FILE ===

-- 
Student Account

-- 
Calday Grange Grammar School is a charitable company limited by guarantee 
and registered in England and Wales with company number 8332696.
The 
Registered Office is at Grammar School Lane, West Kirby, Wirral, CH48 8GG


More information about the Tutor mailing list