Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-7282

[Python] IO functions should raise FileNotFoundError when appropriate

    XMLWordPrintableJSON

Details

    Description

      I get the following error when trying to open a file that does not exist.

      ```
      pyarrow.lib.ArrowIOError: Failed to open local file 'filename', error: No such file or directory

      ```

      In my opinion, this particular error should also subclass from Python FileNotFoundError. It currently only inherits from IOError (which is a superclass of FileNotFoundError).

      ```
      >>> import pyarrow
      >>> try:
      ...     raise pyarrow.lib.ArrowIOError
      ... except IOError:
      ...     pass
      ...
      >>> try:
      ...     raise pyarrow.lib.ArrowIOError
      ... except FileNotFoundError:
      ...     print('caught')
      ...
      Traceback (most recent call last):
      File "<stdin>", line 2, in <module>
      pyarrow.lib.ArrowIOError
      >>> try:
      ...     raise pyarrow.lib.ArrowIOError
      ... except IOError:
      ...     print('caught')
      ...
      caught
      ```

      Attachments

        Issue Links

          Activity

            People

              apitrou Antoine Pitrou
              scottgigante Scott Gigante
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 1h Original Estimate - 1h
                  1h
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 10m
                  1h 10m