WikiSQL icon indicating copy to clipboard operation
WikiSQL copied to clipboard

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

Open ArashEsk95 opened this issue 5 years ago • 5 comments

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'

ArashEsk95 avatar Sep 20 '20 21:09 ArashEsk95

@ablaze95 did you find the solution ?

musamaalvi avatar Oct 06 '20 19:10 musamaalvi

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

Kunald199 avatar Jan 04 '21 20:01 Kunald199

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.

Timothyxxx avatar Aug 03 '21 17:08 Timothyxxx

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

yeliu918 avatar Jan 23 '22 06:01 yeliu918

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'))"

Timothyxxx avatar Jan 23 '22 07:01 Timothyxxx