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

Luke Paireepinart rabidpoobear at gmail.com
Tue Apr 19 15:29:47 CEST 2011


It's saying one of your variables is not a string. Is one of them a sequence? Perhaps Mir-seq? If so, you need to come up with a way to build a string from this object. You can call the str method and pass in your object or you can explicitly create a string from the data in the object.

-----------------------------
Sent from a mobile device. Apologies for brevity and top-posting.
-----------------------------

On Apr 19, 2011, at 7:57 AM, Kann Vearasilp <vearasilp at gmail.com> wrote:

> 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
> #############################################################
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor


More information about the Tutor mailing list