-
Notifications
You must be signed in to change notification settings - Fork 367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix client is None #7097
fix client is None #7097
Conversation
@d710055071 Thank you for the contribution and nice catch! |
I have added CLA |
This is the first line of code I have contributed to the open source community. Thank you very much |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @d710055071 looks good.
One lint comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Closes #7111
Change Description
`
def get_client():
from lakefs.client import Client
clt = Client(username=username, password=password, host=host)
return clt
clt = get_client()
repo = lakefs.Repository(repository_id="datalab",client=clt)
ref = repo.ref(ref_id="main")
stored_object = ref.object(path="coco/coco128.zip")
fd = stored_object.reader()
filedata = fd.read()
save_obj = open("coco128.zip","wb")
save_obj.write(filedata)
save_obj.close()
`
Background
(dinov2) dongzf@dongzf-LEGION-REN7000P-26AMR:/mnt/sda/code/lakeFS-master$ cd /mnt/sda/code/lakeFS-master ; /usr/bin/env /home/dongzf/miniconda3/envs/dinov2/bin/python /home/dongzf/.vscode/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 50565 -- /mnt/sda/code/lakeFS-master/clients/python-wrapper/study.py
Traceback (most recent call last):
File "/home/dongzf/miniconda3/envs/dinov2/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/dongzf/miniconda3/envs/dinov2/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/dongzf/.vscode/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/main.py", line 39, in
cli.main()
File "/home/dongzf/.vscode/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main
run()
File "/home/dongzf/.vscode/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 284, in run_file
runpy.run_path(target, run_name="main")
File "/home/dongzf/.vscode/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 321, in run_path
return _run_module_code(code, init_globals, run_name,
File "/home/dongzf/.vscode/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 135, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/home/dongzf/.vscode/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code
exec(code, run_globals)
File "/mnt/sda/code/lakeFS-master/clients/python-wrapper/study.py", line 28, in
fd = stored_object.reader()
File "/mnt/sda/code/lakeFS-master/clients/python-wrapper/lakefs/object.py", line 564, in reader
return ObjectReader(self, mode=mode, pre_sign=pre_sign, client=self._client)
File "/mnt/sda/code/lakeFS-master/clients/python-wrapper/lakefs/object.py", line 209, in init
super().init(obj, mode, pre_sign, client)
File "/mnt/sda/code/lakeFS-master/clients/python-wrapper/lakefs/object.py", line 75, in init
self._pre_sign = pre_sign if pre_sign is not None else client.storage_config.pre_sign_support
AttributeError: 'NoneType' object has no attribute 'storage_config'
Bug Fix
If this PR is a bug fix, please let us know about:
New Feature
If this PR introduces a new feature, describe it here.
Testing Details
How were the changes tested?
Breaking Change?
Does this change break any existing functionality? (API, CLI, Clients)
Additional info
Logs, outputs, screenshots of changes if applicable (CLI / GUI changes)
Contact Details
How can we get in touch with you if we need more info? (ex. email@example.com)