@@ -519,19 +519,21 @@ def _open_url_and_load_gzip_file(url, data_home, n_retries, delay, arff_params):
519
519
url , data_home , n_retries , delay , arff_params
520
520
)
521
521
except Exception as exc :
522
- if parser == "pandas" :
523
- from pandas .errors import ParserError
524
-
525
- if isinstance (exc , ParserError ):
526
- # A parsing error could come from providing the wrong quotechar
527
- # to pandas. By default, we use a double quote. Thus, we retry
528
- # with a single quote before to raise the error.
529
- arff_params ["read_csv_kwargs" ] = {"quotechar" : "'" }
530
- X , y , frame , categories = _open_url_and_load_gzip_file (
531
- url , data_home , n_retries , delay , arff_params
532
- )
533
- else :
534
- raise
522
+ if parser != "pandas" :
523
+ raise
524
+
525
+ from pandas .errors import ParserError
526
+
527
+ if not isinstance (exc , ParserError ):
528
+ raise
529
+
530
+ # A parsing error could come from providing the wrong quotechar
531
+ # to pandas. By default, we use a double quote. Thus, we retry
532
+ # with a single quote before to raise the error.
533
+ arff_params ["read_csv_kwargs" ] = {"quotechar" : "'" }
534
+ X , y , frame , categories = _open_url_and_load_gzip_file (
535
+ url , data_home , n_retries , delay , arff_params
536
+ )
535
537
536
538
return X , y , frame , categories
537
539
0 commit comments