You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.
look this function doesn't check if file is open or no...
def Pull(self, device_filename, dest_file=None, timeout_ms=None, progress_callback=None):
"""Pull a file from the device.
Args:
device_filename: Filename on the device to pull.
dest_file: If set, a filename or writable file-like object.
timeout_ms: Expected timeout for any part of the pull.
progress_callback: callback method that accepts filename, bytes_written and total_bytes,
total_bytes will be -1 for file-like objects
Returns:
The file data if dest_file is not set. Otherwise, True if the destination file exists
"""
if not dest_file:
dest_file = io.BytesIO()
elif isinstance(dest_file, str):
dest_file = open(dest_file, 'wb')
elif isinstance(dest_file, file):
pass
else:
raise ValueError("destfile is of unknown type")
conn = self.protocol_handler.Open(
self._handle, destination=b'sync:', timeout_ms=timeout_ms)
self.filesync_handler.Pull(conn, device_filename, dest_file, progress_callback)
conn.Close()
if isinstance(dest_file, io.BytesIO):
return dest_file.getvalue()
else:
dest_file.close()
if hasattr(dest_file, 'name'):
return os.path.exists(dest_file.name)
# We don't know what the path is, so we just assume it exists.
return True
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Like that:
The text was updated successfully, but these errors were encountered: