Skip to content
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

getting a nonexistent data object leaves an empty local file #681

Open
trel opened this issue Jan 21, 2025 · 1 comment
Open

getting a nonexistent data object leaves an empty local file #681

trel opened this issue Jan 21, 2025 · 1 comment
Labels
Milestone

Comments

@trel
Copy link
Member

trel commented Jan 21, 2025

If logical_path is not a valid logical path...

import os
from irods.session import iRODSSession
env_file = os.path.expanduser("~/.irods/irods_environment.json")
ssl_settings = {}
session = iRODSSession(irods_env_file=env_file, **ssl_settings)

logical_path = '/{0.zone}/home/{0.username}/does_not_exist.txt'.format(session)
local_file = 'should_not_exist.txt'
session.data_objects.get(logical_path, local_file)

This should not create and leave a new empty should_not_exist.txt.

@trel trel added the bug label Jan 21, 2025
@alanking
Copy link
Contributor

Might just need to swap the order of these context managers...

with open(local_file, "wb") as f:
with self.open(
obj, "r", returned_values=data_open_returned_values_, **options
) as o:

@korydraughn korydraughn added this to the 3.1.0 milestone Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants