I am trying to take a screenshot through a python script. I have gone through both of these
https://stackoverflow.com/a/782768/7504076 and https://github.com/JDongian/neobot/blob/master/Linux/Robot/screen.py
Both run successfully, but on a couple of machines it just returns a black screen always. On some machines it returns perfect screenshots. I just don't seem to understand what seems to be the problem.
I'm running only on Macs, but the problem is not confined to a particular OS version, as it runs on a couple of machines running El-Capitan and Sierra and also fails on machines running the same OS's.
Is it some system setting that should be changed or some parameter that I can change to get proper image.