I just wanted to post something similar - it's important that the new sequence 'ATTGG' is an object of class Seq, not a string, because then you'll get (at least on my system with Python 2.7.5 and BioPython 1.62b)
SeqRecord (id=test) has an invalid sequence.
• 175 views
•
link
If you are hitting an error relating to letter annotations (e.g. "You must empty the letter annotations first!"), you can copy them to a temporary dict object while you modify the seq, clear them, and then copy them back to the SeqRecord afterwards.