Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Receiving TypeError #2

Open
shford opened this issue Jul 12, 2024 · 1 comment
Open

Receiving TypeError #2

shford opened this issue Jul 12, 2024 · 1 comment

Comments

@shford
Copy link

shford commented Jul 12, 2024

I installed this package using pip per the github readme file. Then in my terminal prompt I ran:
C:\Users\_my_path_to_input_file_> anki_deck_from_text '.\out_GCSE French Foundation Vocabulary and Higher Vocab List (2009).txt' gcse.apkg 'GCSE French Foundation Vocabulary and Higher Vocabulary List (2009/2019)' --card_model 'basic'

Note: I'm not sure if it's helpful, but I tried --card_model 'basic' and --card_model 'sound' with and without quotes both after the command and at the end.

Every-time I received the following error:
TypeError: cannot unpack non-iterable NoneType object

My IDE showed the culprit to be in parse_input.py function:
def question_answer_split(line, separator, marker): line = line.lstrip(marker) answer, question = line.split(separator) return question.strip(), answer.strip()

My environment is relatively fresh install of Windows 10 Pro 22H2. Please let me know if there's any more information that would prove helpful!

@AndreMacedo88
Copy link
Owner

Super sorry for the delay in answering! I hope my comment is still relevant...
From your description of the problem, I can't seem to figure out the problem.

It seems that answer, question = line.split(separator) is trying to unpack None. I tested all the possibilities that came to my mind and checked the docs and could not make line.split(separator) return None.

Can you try a few things:

  • Can you check that in all the lines of your .txt file that start with the marker (default is -) you have a separator (default is =) between word and translation (or definition)?
  • Can you try on a much smaller version of your file (just a few lines that follow the structure shown in the example) to see if it works then? If so, you can then progressively add more lines to troubleshoot the problematic line.

I understand if that's too much trouble, so if you feel comfortable sending me your file (or a modified version that still shows the same problem) I would be happy to troubleshoot it myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants