'Django Cant Catch error from pandas dataframe

I try to catch an error that shows in the template that said:

ArrowTypeError at /user_area/absent/2840 Atlantic Ave/
("Expected bytes, got a 'int' object", 'Conversion failed for column ZipCode with type object')
Request Method: GET
Request URL:    http://127.0.0.1:8000/user_area/absent/2840%20Atlantic%20Ave/
Django Version: 3.2.12
Exception Type: ArrowTypeError
Exception Value:    
("Expected bytes, got a 'int' object", 'Conversion failed for column ZipCode with type object')
Exception Location: pyarrow/error.pxi, line 122, in pyarrow.lib.check_status

my code is like :

  try:
      return pd.read_feather(os.path.join(cache_folder, file))
  except Exception as e:
      print(e)
      return get_api_info(request_items, url_requested, now)

what I want is to as soon the ArrowTypeError comes up, the Except return get_api_info(). is there anyway way I can do that? thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source