jingw / pyhdfs

Python HDFS client

Home Page:https://pyhdfs.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HdfsFileAlreadyExistsException is not implemented?

james77777778 opened this issue · comments

Hi!
Thanks for your great work.
I have noticed that some Exceptions are not implemented right now?

For example:
If I try to upload the file with same path, the python raises ConnectionError instead of HdfsFileAlreadyExistsException.

error message as following:

Traceback (most recent call last):
  File "test_pyhdfs.py", line 12, in <module>
    fs.create('/xxx/xxx/images/test.png', data=file)
  File "/home/chiuhongyu/workplace/xxx/venv/lib/python3.6/site-packages/pyhdfs/__init__.py", line 504, in create
    metadata_response.headers['location'], data=data, **self._requests_kwargs)
  File "/home/chiuhongyu/workplace/xxx/venv/lib/python3.6/site-packages/requests/api.py", line 132, in put
    return request('put', url, data=data, **kwargs)
  File "/home/chiuhongyu/workplace/xxx/venv/lib/python3.6/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/chiuhongyu/workplace/xxx/venv/lib/python3.6/site-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/chiuhongyu/workplace/xxx/venv/lib/python3.6/site-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/home/chiuhongyu/workplace/xxx/venv/lib/python3.6/site-packages/requests/adapters.py", line 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

Hello. HdfsFileAlreadyExistsException is implemented, and you can see in the following test case that it does get raised when appropriate:

with self.assertRaises(HdfsFileAlreadyExistsException):

This error is saying that somebody broke your connection. It is likely something about your network, and is likely unrelated to whether the file exists or not.