from desktopmagic.screengrab_win32 import GrabFailed, getScreenAsImage

def main():
	print """\
This program helps you test whether screengrab_win32 has memory leaks
and other problems.  It takes a screenshot repeatedly and discards it.

Open Task Manager and make sure Physical Memory % is not ballooning.
Memory leaks might not be blamed on the python process itself (which
will show low memory usage).

Lock the workstation for a few minutes; make sure there are no leaks
and that there are no uncaught exceptions here.

Repeat above after RDPing into the workstation and minimizing RDP;
this is like disconnecting the monitor.

Change your color depth settings.  Add and remove monitors.  RDP
into at 256 colors.
"""
	while True:
		try:
			getScreenAsImage()
			print ".",
		except GrabFailed, e:
			print e


if __name__ == '__main__':
	main()

from desktopmagic.screengrab_win32 import GrabFailed, getScreenAsImage, getDisplaysAsImages, getRectAsImage

def main():
	print """\
This program helps you test whether screengrab_win32 has memory leaks
and other problems.  It takes a screenshot repeatedly and discards it.

Open Task Manager and make sure Physical Memory % is not ballooning.
Memory leaks might not be blamed on the python process itself (which
will show low memory usage).

Lock the workstation for a few minutes; make sure there are no leaks
and that there are no uncaught exceptions here.

Repeat above after RDPing into the workstation and minimizing RDP;
this is like disconnecting the monitor.

Change your color depth settings.  Add and remove monitors.  RDP
into at 256 colors.
"""
	while True:
		try:
			getScreenAsImage()
			print "S",
		except GrabFailed, e:
			print e

		try:
			getDisplaysAsImages()
			print "D",
		except GrabFailed, e:
			print e

		try:
			getRectAsImage((0, 0, 1, 1))
			print "R",
		except GrabFailed, e:
			print e


if __name__ == '__main__':
	main()

Make screengrab_torture_test test more functions