[ 
https://issues.apache.org/jira/browse/ARROW-7282?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Scott Gigante updated ARROW-7282:
---------------------------------
    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
 ```

  was:
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
```


> [Python] IOError subclassing
> ----------------------------
>
>                 Key: ARROW-7282
>                 URL: https://issues.apache.org/jira/browse/ARROW-7282
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Python
>    Affects Versions: 0.15.1
>         Environment: Arch Linux, Python 3.7
>            Reporter: Scott Gigante
>            Priority: Minor
>              Labels: exception-reporting, pyarrow
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> 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
>  ```



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to