Skip to content

ValueError: invalid literal for int() with base 10: #14

@zdenop

Description

@zdenop

Hello,

first of all: thanks for this project. I just try it for dictionary I maintained and it fails with :
ValueError: invalid literal for int() with base 10: 'šími/Fs'

Which is great because .aff file has error, but this message does not said for ordinary user...
Is there any function to check correctness of .dic and .aff files?
Or at least please provide better error message with something like this:

@@ -246,10 +246,15 @@ def read_value(source: BaseReader, directive: str, *values, context: Context) ->
         ]
     if directive in ['SFX', 'PFX']:
         flag, crossproduct, count, *_ = values
-        return [
-            make_affix(directive, flag, crossproduct, *line, context=context)
-            for line in _read_array(int(count))
-        ]
+        try:
+            return [
+                make_affix(directive, flag, crossproduct, *line, context=context)
+                for line in _read_array(int(count))
+            ]
+        except ValueError as error:
+            print(f"Error at: directive, values: {directive}, {values}")
+            print(f"Maybe wrong count of rules?")
+            raise error

Most of the spellcheckers create function for end users but forgot about dictionary creators and maintainers ;-) (Aspell at least tried to report e.g. affix problems when creating dictionary from wordlist...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions