Not sure if you just copied and pasted this code, but you found your own problem and your own solution..
As you might guess > is an html entity of the character '>' - greater than
Change this line:
Code:
if bytesToCopy > = len(keyData):
to this:
Code:
if bytesToCopy >= len(keyData):
Please NEVER, EVER, EVER blindly copy and paste python.. always re-write it yourself. This will help you understand what you are trying to accomplish and will make sure some punk who posted that code isn't pulling your leg for a good, cheap laugh