[Tutor] Type error: must be string or read-only character buffer, not seq

Kann Vearasilp vearasilp at gmail.com
Tue Apr 19 14:57:17 CEST 2011


Dear all,

I tried concatenating string variables with multiple strings and have the
file handle write the statement into a file. I don't know why I always get
the type error: must be string or read-only character buffer, not seq error.
I tried casting the whole new concatenated string using str(), but was not
successful as well. Do you have any clue why this happen?

Best,

Kann


#############################################################
 42
 43         statement = 'mirna = miRBase(accession = "' + mir_acc + '", '\
 44             + 'name = "' + mir_name + '", '\
 45             + 'specie = "' + mir_specie + '", '\
 46             + 'description = "' + mir_desc + '", '\
 47             + 'refDBs = "' + mir_dbrefs + '", '\
 48             + 'comment = "' + mir_comment + '", '\
 49             + 'seq = "' + mir_seq + '")' + "\n"
 50
 51
 52         str(statement)
 53         insert.write(statement)

############################################################3
processing the insert statment
Traceback (most recent call last):
  File "mirbase.py", line 60, in <module>
    generate_insert(db_file)
  File "mirbase.py", line 53, in generate_insert
    insert.write(statement)
TypeError: must be string or read-only character buffer, not Seq
#############################################################
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110419/acae2bc9/attachment.html>


More information about the Tutor mailing list