When I put my Mac to sleep while an interactive Python session with a selenium instance and corresponding browser is running, after waking up the browser (or selenium server?) are no longer responding to any commands from the Python shell.
This forces me to restart the browser, losing the state of my test.
Is there a way to overcome this?
You might be able to make this work by setting ridiculously large timeout values on your Selenium commands.  But, you may still run into a problem where MacOS X kills the network connection when it goes to sleep.  Once the connection is severed, you're only real option would be to grab the test session ID and try to reconnect to it, providing Selenium hasn't time the commands out yet.
How to resume a Selenium RC test after a computer sleep?