You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "trim21 (via GitHub)" <gi...@apache.org> on 2024/12/25 00:16:32 UTC

[I] bug: python exception module name doesn't match [opendal]

trim21 opened a new issue, #5452:
URL: https://github.com/apache/opendal/issues/5452

   ### Describe the bug
   
   `op.read("non-exists-path")` will throw exception like this:
   
   ```python
   Traceback (most recent call last):
     File "C:\Users\Trim21\proj\test\f.py", line 13, in <module>
       op.read("non-exists-path")
   opendal.NotFoundError: NotFound (permanent) at stat, context: { service: redis, path: non-exists-path } => kv doesn't have this path
   ```
   
   But if you actually try to use catch exception `opendal.NotFoundError` you will encounter another error:
   
   ```python
   try:
       op.read("non-exists-path")
   except opendal.NotFoundError as e:
       print(e)
   ```
   
   ```text
   Traceback (most recent call last):
     File "C:\Users\Trim21\proj\test\f.py", line 14, in <module>
       op.read("non-exists-path")
   opendal.NotFoundError: NotFound (permanent) at stat, context: { service: redis, path: non-exists-path } => kv doesn't have this path
   
   During handling of the above exception, another exception occurred:
   
   Traceback (most recent call last):
     File "C:\Users\Trim21\proj\test\f.py", line 15, in <module>
       except opendal.NotFoundError as e:
   AttributeError: module 'opendal' has no attribute 'NotFoundError'
   ```
   
   
   ### Steps to Reproduce
   
   ```python
   import opendal
   
   
   op = opendal.Operator(...)    
   
   try:
       op.read("non-exists-path")
   except opendal.NotFoundError as e:
       print(e)
   ```
   
   ### Expected Behavior
   
   exception module name should match or re-export them from top level
   
   ### Additional Context
   
   _No response_
   
   ### Are you willing to submit a PR to fix this bug?
   
   - [ ] Yes, I would like to submit a PR.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] bug: python exception module name and class name both don't match [opendal]

Posted by "messense (via GitHub)" <gi...@apache.org>.
messense closed issue #5452: bug: python exception module name and class name both don't match
URL: https://github.com/apache/opendal/issues/5452


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org