It'd be nice if you could print the message of the error here, and be more specific in your question.

One thing that comes to my mind is that fact that you use the append() method... Can you think...