0

I have a script that is going to download a lot of data from the internet. But, I have no idea how long will it take or how big the data it will be.

To be more precise I want to analyze some live videos and for that I will download the content using youtube-dl. Since I want to leave it running for a week or two, is there a way so that can avoid running into low memory problem, that the computer checks on a specific interval what is my memory status and if it is below a certain value to stop the execution?

Thanks

CroatiaHR
  • 615
  • 6
  • 24

2 Answers2

0

You can use shutil.disk_usage(path) from the docs:

shutil.disk_usage(path)

Return disk usage statistics about the given path as a named tuple with the attributes total, used and free, which are the amount of total, used and free space, in bytes. On Windows, path must be a directory; on Unix, it can be a file or directory.

Carlos Gonzalez
  • 858
  • 13
  • 23
0

Use shutil.disk_usage.

total, used, free = shutil.disk_usage("/")
Priyatham
  • 2,821
  • 1
  • 19
  • 33