Cloze deletion unexpected behaviour

Hi everyone,

I’m experiencing an issue with a cloze deletion. Specifically, when reviewing this card, c5 extends to the very end of the card instead of stopping at the next }} (after “fall off!”). Here is the complete text of the card (originally from 2. Using the Python Interpreter — Python 3.13.1 documentation):

2.1.1. Argument Passing
When {{c1::known to the interpreter, the script name and additional arguments thereafter are turned into a list of strings and assigned to the argv variable in the sys module}}. You {{c2::can access this list by executing import sys}}. The length {{c3::of the list is at least one; when no script and no arguments are given, sys.argv[0] is an empty string. When the script name is given as '-' (meaning standard input), sys.argv[0] is set to '-'. When -c command is used, sys.argv[0] is set to '-c'. When -m module is used, sys.argv[0] is set to the full name of the located module}}. Options {{c4::found after -c command or -m module are not consumed by the Python interpreter’s option processing but left in sys.argv for the command or module to handle}}.

2.1.2. Interactive Mode
When {{c5::commands are read from a tty, the interpreter is said to be in interactive mode. In this mode it prompts for the next command with the primary prompt, usually three greater-than signs (>>>); for continuation lines it prompts with the secondary prompt, by default three dots (...). The interpreter prints a welcome message stating its version number and a copyright notice before printing the first prompt:

python 3.13
Python 3.13 (default, April 4 2023, 09:25:04)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

Continuation lines are needed when entering a multi-line construct. As an example, take a look at this if statement:

>>> the_world_is_flat = True
>>> if the_world_is_flat:
...        print("Be careful not to fall off!")
...
Be careful not to fall off!
}}


2.2. The Interpreter and Its Environment
2.2.1. Source Code Encoding

By default, {{c6::Python source files are treated as encoded in UTF-8. In that encoding, characters of most languages in the world can be used simultaneously in string literals, identifiers and comments — although the standard library only uses ASCII characters for identifiers, a convention that any portable code should follow. To display all these characters properly, your editor must recognize that the file is UTF-8, and it must use a font that supports all the characters in the file}}.

To declare an encoding other than the default one, a special comment line should be added as the first line of the file. The syntax is as follows:
# -*- coding: encoding -*-

where encoding is one of the valid codecs supported by Python.
For example, to declare that Windows-1252 encoding is to be used, the first line of your source code file should be:
# -*- coding: cp1252 -*-

One exception to the first line rule is when the source code starts with a UNIX “shebang” line. In this case, the encoding declaration should be added as the second line of the file. For example:
#!/usr/bin/env python3
# -*- coding: cp1252 -*-

Is anybody else able to reproduce this? Am I doing something wrong? Thanks in advance.

Works fine for me on 24.11. Are you using a modified cloze notetype?

Also, i’d be remiss if i didn’t direct you to that famous article on making effective flashcards

2 Likes

I do have the Flexible Cloze 2 addon installed, but this is with the default cloze notetype.
I realize the way I make my flashcards goes against conventional wisdow, but it’s very effective for me - I can easily learn entire paragraphs.

You should definitely try it with add-ons disabled – see: safe mode #2 Troubleshooting - Anki Manual .

You should also take a closer look at that text and see if there are any hidden characters or “look-alike” characters that are interfering with the ending brackets being recognized. Open the HTML view of the field to get a more precise look at things – click < > above the field.

1 Like

I should have mentioned the problem is also present on AnkiDroid so it can’t be caused by an addon. For the time being I have found a workaround in clozing images of the text and not copy-pasting the text directly. Thanks to both for replying.