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

AttributeError: 'NoneType' object has no attribute 'number_symbols' #72

Open
ArashEsk95 opened this issue Sep 20, 2020 · 5 comments
Open

Comments

@ArashEsk95
Copy link

When i run evaluate.py on example 'pred.dev.jsonl' i get this error, what sould i do?
C:\Users\Admin\anaconda3\python.exe C:/Users/Admin/Desktop/WikiSQL-master/evaluate.py
30%|██▉ | 2517/8421 [00:04<00:10, 562.58it/s]
Traceback (most recent call last):
File "C:/Users/Admin/Desktop/WikiSQL-master/evaluate.py", line 29, in
gold = engine.execute_query(eg['table_id'], qg, lower=True)
File "C:\Users\Admin\Desktop\WikiSQL-master\lib\dbengine.py", line 18, in execute_query
return self.execute(table_id, query.sel_index, query.agg_index, query.conditions, *args, **kwargs)
File "C:\Users\Admin\Desktop\WikiSQL-master\lib\dbengine.py", line 40, in execute
val = float(parse_decimal(val))
File "C:\Users\Admin\anaconda3\lib\site-packages\babel\numbers.py", line 707, in parse_decimal
group_symbol = get_group_symbol(locale)
File "C:\Users\Admin\anaconda3\lib\site-packages\babel\numbers.py", line 332, in get_group_symbol
return Locale.parse(locale).number_symbols.get('group', u',')
AttributeError: 'NoneType' object has no attribute 'number_symbols'

@musamaalvi
Copy link

@ablaze95 did you find the solution ?

@Kunald199
Copy link

Hello.
I am having the same issue. Any solution to this problem yet?

@Timothyxxx
Copy link

Timothyxxx commented Aug 3, 2021

Hi~I met the same problem, after read through the code I found it is due to the fact that the it is because in wikisql lib dbengine.py, when using "val = float(parse_decimal(val))" to convert the decimal string to decimal, they used babel package's parse_decimal method in default parameter of "locale"("locale" is what decide how to explain the number, for example if in "en", 197,168 means 197168, while in "de" German, it means 197.168), and the default locale is judeged by you utf-encode of the python file. So it may perform normal in mostly conditions, especially in US I think, but unnormally performed in some cases, which it set the locale to None, which cause the problem above "AttributeError: 'NoneType' object has no attribute 'number_symbols'", TL;DR, please change "val = float(parse_decimal(val))" to "val = float(parse_decimal(val, locale='en_US'))" , And I hope this be fixed or be pulled request to this wikisql code to make it perform well on all the devices.

@yeliu918
Copy link

Hi, I have the same issue. Any solution to this problem yet?

@Timothyxxx
Copy link

Hi, I have the same issue. Any solution to this problem yet?
TL;DR, please change "val = float(parse_decimal(val))" to "val = float(parse_decimal(val, locale='en_US'))"

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

5 participants