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

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

Open
zdenop opened this issue Oct 11, 2021 · 1 comment
Open

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

zdenop opened this issue Oct 11, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@zdenop
Copy link

zdenop commented Oct 11, 2021

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...)

@zverok
Copy link
Owner

zverok commented Oct 18, 2021

Hey!

To be completely honest, when I started the project, that was one of the (distant) goals: tol also do a tool for dictionary investigation/debugging/validation (as Spylls attempts to make things more "understable and hackable"). But to put a basis in place, document it, and describe it all in a series of articles took 1,5 years of my OSS time, so currently my attention is mostly on other projects.

That being said, I'll gladly accept a PR which makes dictionary authors' life better :)

zdenop added a commit to zdenop/spylls that referenced this issue Oct 22, 2021
@zverok zverok added the enhancement New feature or request label Jan 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants