salesforce / WikiSQL

A large annotated semantic parsing corpus for developing natural language interfaces.
BSD 3-Clause "New" or "Revised" License
1.6k stars 320 forks source link

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

Open ArashEsk95 opened 3 years ago

ArashEsk95 commented 3 years ago

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 commented 3 years ago

@ablaze95 did you find the solution ?

Kunald199 commented 3 years ago

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

Timothyxxx commented 2 years ago

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 commented 2 years ago

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

Timothyxxx commented 2 years ago

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