0

I'm writing a script to upload videos to a Vimeo account using Python and the PyVimeo library. I'm not the only one who uses the program as I share it with a few other people who need to upload to the same Vimeo account. One of these users has been encountering an issue where the upload starts but never finishes resulting in a corrupted upload. I have the logging module setup in the script so when anyone runs into issues I can see what's going on behind the scenes and what I'm noticing is that when this specific user uploads a file, the script opens an extra HTTPS connection at certain points that I think seems to mess up the upload. I have not been able to replicate this issue on my own PC and so far it only seems to happen on this one-user's PC. The user is running Windows 11 and I am running Windows 10, however I have other users who I know use the script running Windows 11 and it works fine for them.

(I changed the ID's around to be safe when posting publicly.)

Log of failed upload from users PC:

08/20/2023 10:53:06 AM [DEBUG] | Attempting to upload video: B&P.mp4 with title test
08/20/2023 10:53:06 AM [DEBUG] | Starting new HTTPS connection (1): api.vimeo.com:443
08/20/2023 10:53:08 AM [DEBUG] | https://api.vimeo.com:443 "POST /me/videos?fields=uri%2Cupload HTTP/1.1" 200 247
08/20/2023 10:53:08 AM [DEBUG] | Starting new HTTPS connection (1): us-files.tus.vimeo.com:443
08/20/2023 10:53:08 AM [DEBUG] | https://us-files.tus.vimeo.com:443 "HEAD /files/vimeo-prod-src-tus-us/1a36da0c52392eb007155083b0d47ba3 HTTP/1.1" 200 0
08/20/2023 10:53:08 AM [DEBUG] | Starting new HTTPS connection (1): us-files.tus.vimeo.com:443
08/20/2023 10:53:39 AM [DEBUG] | Starting new HTTPS connection (1): us-files.tus.vimeo.com:443
08/20/2023 10:53:39 AM [DEBUG] | https://us-files.tus.vimeo.com:443 "HEAD /files/vimeo-prod-src-tus-us/1a36da0c52392eb007155083b0d47ba3 HTTP/1.1" 200 0
08/20/2023 10:53:39 AM [DEBUG] | Starting new HTTPS connection (1): us-files.tus.vimeo.com:443
08/20/2023 10:54:40 AM [DEBUG] | Starting new HTTPS connection (1): us-files.tus.vimeo.com:443
08/20/2023 10:54:41 AM [DEBUG] | https://us-files.tus.vimeo.com:443 "HEAD /files/vimeo-prod-src-tus-us/1a36da0c52392eb007155083b0d47ba3 HTTP/1.1" 200 0
08/20/2023 10:54:41 AM [DEBUG] | Starting new HTTPS connection (1): us-files.tus.vimeo.com:443
08/20/2023 10:55:50 AM [DEBUG] | Starting new HTTPS connection (1): us-files.tus.vimeo.com:443
08/20/2023 10:55:50 AM [DEBUG] | https://us-files.tus.vimeo.com:443 "HEAD /files/vimeo-prod-src-tus-us/1a36da0c52392eb007155083b0d47ba3 HTTP/1.1" 200 0
08/20/2023 10:55:50 AM [DEBUG] | Starting new HTTPS connection (1): us-files.tus.vimeo.com:443
08/20/2023 10:55:52 AM [ERROR] | 'TusUploadFailed' object has no attribute 'message'

Here is the log of a successful upload I did on my PC with the same video file:

08/21/2023 02:15:05 PM [DEBUG] | Attempting to upload video: B&P.mp4 with title test
08/21/2023 02:15:05 PM [DEBUG] | Starting new HTTPS connection (1): api.vimeo.com:443
08/21/2023 02:15:07 PM [DEBUG] | https://api.vimeo.com:443 "POST /me/videos?fields=uri%2Cupload HTTP/1.1" 200 247
08/21/2023 02:15:07 PM [DEBUG] | Starting new HTTPS connection (1): us-files.tus.vimeo.com:443
08/21/2023 02:15:07 PM [DEBUG] | https://us-files.tus.vimeo.com:443 "HEAD /files/vimeo-prod-src-tus-us/57319451fa57a7a3d99bf9769385a809 HTTP/1.1" 200 0
08/21/2023 02:15:07 PM [DEBUG] | Starting new HTTPS connection (1): us-files.tus.vimeo.com:443
08/21/2023 02:15:48 PM [DEBUG] | https://us-files.tus.vimeo.com:443 "PATCH /files/vimeo-prod-src-tus-us/57319451fa57a7a3d99bf9769385a809 HTTP/1.1" 204 0
08/21/2023 02:15:48 PM [DEBUG] | Starting new HTTPS connection (1): us-files.tus.vimeo.com:443
08/21/2023 02:16:30 PM [DEBUG] | https://us-files.tus.vimeo.com:443 "PATCH /files/vimeo-prod-src-tus-us/57319451fa57a7a3d99bf9769385a809 HTTP/1.1" 204 0
08/21/2023 02:16:30 PM [DEBUG] | Starting new HTTPS connection (1): us-files.tus.vimeo.com:443
08/21/2023 02:17:11 PM [DEBUG] | https://us-files.tus.vimeo.com:443 "PATCH /files/vimeo-prod-src-tus-us/57319451fa57a7a3d99bf9769385a809 HTTP/1.1" 204 0
08/21/2023 02:17:11 PM [DEBUG] | Starting new HTTPS connection (1): us-files.tus.vimeo.com:443
08/21/2023 02:17:29 PM [DEBUG] | https://us-files.tus.vimeo.com:443 "PATCH /files/vimeo-prod-src-tus-us/57319451fa57a7a3d99bf9769385a809 HTTP/1.1" 204 0
08/21/2023 02:17:29 PM [DEBUG] | /videos/123456789
08/21/2023 02:17:29 PM [DEBUG] | Starting new HTTPS connection (1): api.vimeo.com:443
08/21/2023 02:17:29 PM [DEBUG] | https://api.vimeo.com:443 "GET /videos/123456789?fields=link HTTP/1.1" 200 49
08/21/2023 02:17:29 PM [DEBUG] | Video successfully uploaded.

This is the section of my code that attempts to upload the video:

file_name = os.path.basename(video)
logging.debug(f"Attempting to upload video: {file_name} with title {title}")
try:
    upload = client.upload(video, data={
        'name': f'{title}',
        'description': f'{description}'})
except vexceptions.VideoUploadFailure as e:
    print(f'Error uploading {file_name}')
    print(f'Server reported: {e.message}')
print(upload)
logging.debug(upload)
response = client.get(upload + '?fields=link').json()

To note, the error that gets logged to the log file isn't caught by the try except block here, it's caught by a general try except block I have around the entire main function:

if __name__ == "__main__":
    try:
        main()
    except Exception as e:
        logging.error(e)
        print(f'Error occurred:\n{e)}')

I have tried a couple of different fixes according to what I found online. I've attempted to adjust the chunk size of the upload as listed in this thread. I went as high as 100MB and as low as 512kb per chunk and neither helped the issue. This issue seems to happen despite the size of the file, I had the user try with a 10MB file and with a 600MB file and both failed with pretty much the same logs. I tried checking the users internet settings to see if there was any reason it might be randomly closing the connection then opening it back up but I was unable to find anything indicating that.

Any help would be greatly appreciated! The user is willing to run tests or give me any info needed, I just need to ask them.

Mostafa Arian Nejad
  • 1,278
  • 1
  • 19
  • 32

0 Answers0