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

get_file_by_server_relative_url length attribute is -1 even when subsequent download_session returns many bytes #834

Open
nmz787-intel opened this issue Mar 1, 2024 · 0 comments
Labels

Comments

@nmz787-intel
Copy link

file_metadata = source_file.expand(["versions", "listItemAllFields", "Author"]).get().execute_query()
expected_data_length = source_file.length
local_file = io.BytesIO()
def print_download_progress(offset):
    print("Downloaded '{}' bytes... of: {}".format(offset, filepath))
source_file.download_session(local_file, print_download_progress).execute_query_retry(max_retry=100)
downloaded_length = local_file.getbuffer().nbytes

problem is that expected_data_length often comes back as -1... even when the subsequent downloaded_length returns thousands of bytes. If I keep re-trying this code in a loop... since there is a mismatch, eventually (sometimes after 100s of attempts) they will match.

Using latest version (2.5.6).

@vgrem vgrem added the question label Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants