8000 Unable to encode and decode fiscal codes when year of birth (excluding century) < 10 (eg. 2004) · Issue #79 · fabiocaccamo/python-codicefiscale · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Unable to encode and decode fiscal codes when year of birth (excluding century) < 10 (eg. 2004) #79

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

Closed
deltaredentertainment opened this issue Mar 29, 2023 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@deltaredentertainment
Copy link

Python version
3.9

Current behavior (bug description)
When calling both the .encode and .decode function with any birthplace it raises a ValueError:
Traceback (most recent call last):
File "/Users/davideramondetti/..../handler.py", line 19, in
cod1 = codicefiscale.decode(
File "/Users/davideramondetti/.../venv/lib/python3.9/site-packages/codicefiscale/codicefiscale.py", line 485, in decode
raise ValueError(f"[codicefiscale] wrong birthplace code: {birthplace_code!r}")
ValueError: [codicefiscale] wrong birthplace code: 'L219'

Expected behavior
It is expected for the .decode to return the extracted data, and for the Encode to output the fiscal code.

@fabiocaccamo
Copy link
Owner
fabiocaccamo commented Mar 29, 2023

@deltaredentertainment Could you tell me the input arguments you are using for both, encoding and decoding?

@deltaredentertainment
Copy link
Author

certamente, here is a copy of the code used for trial:

`
from codicefiscale import codicefiscale

cod = codicefiscale.encode(
lastname="Rossi",
firstname="Mario",
gender="M",
birthdate="29/11/2004",
birthplace="Torino",
)

cod1 = codicefiscale.decode(
"RSSMRA00S29L219C"
)

print(cod1)
print(cod)
and here is the error:
site-packages/codicefiscale/codicefiscale.py", line 408, in encode
decode(code)
line 485, in decode
raise ValueError(f"[codicefiscale] wrong birthplace code: {birthplace_code!r}")
ValueError: [codicefiscale] wrong birthplace code: 'L219'`

Thanks!

@deltaredentertainment
Copy link
Author

I have forgot to mention that it gives the error for both encode and decode

@fabiocaccamo
Copy link
Owner

Thank you!
That birthplace code is correct and I'm also sure that it has been used in the test suite.

I will try to replicate the error.

@deltaredentertainment
Copy link
Author

i tried even with others, but it keeps resulting in the same error. Let me know, thanks.

@deltaredentertainment
Copy link
Author

Dear Fabio,
I have downloaded the previous version (0.6.1) and now is working properly.
Regards,
DR

@fabiocaccamo fabiocaccamo changed the title Unable to encode and decode fiscal codes Unable to encode and decode fiscal codes when year of birth (excluding century) < 10 -> eg. 2004 Mar 30, 2023
@fabiocaccamo fabiocaccamo changed the title Unable to encode and decode fiscal codes when year of birth (excluding century) < 10 -> eg. 2004 Unable to encode and decode fiscal codes when year of birth (excluding century) < 10 (eg. 2004) Mar 30, 2023
@fabiocaccamo fabiocaccamo moved this to In Progress in Open Source Mar 30, 2023
@fabiocaccamo
Copy link
Owner

@deltaredentertainment Looking at the cause of the problem I don't understand how the previous version can work well for you.

Anyway... this is fixed now, you can upgrade to 0.7.1 version.

@github-project-automation github-project-automation bot moved this from In Progress to Done in Open Source Mar 30, 2023
@deltaredentertainment
Copy link
Author

thanks, it works.

Sign up for fre 5407 e to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

2 participants
0