Re: [Biopython] GFF3 manipulation

Adam Sjøgren <[email protected]>
Newsgroups gmane.comp.python.bio.general
Organization koldfront - analysis & revolution, Copenhagen, Denmark
Message-ID <[email protected]>
Mic writes:

> out_file = "/Users/lorencm/tmp/Gmp_NbV1_Final.gff3.bak"

...

> with open(out_file, "w") as out_handle:

...

>             out_file.write([rec])

...

> File "test.py", line 19, in <module>
> out_file.write([rec])AttributeError: 'str' object has no attribute
> 'write'*

...

> What did I miss?

'out_file' is a string that contains a file name.

What the error tells you is that you called a method ".write()" on that
string, but strings don't have a method called that.

You need to call ".write()" on the file handle, 'out_handle', instead.


  Best regards,

    Adam

-- 
 "Everything needs to change.                                 Adam Sjøgren
  And it has to start today."                            [email protected]

_______________________________________________
Biopython mailing list  -  [email protected]
https://mailman.open-bio.org/mailman/listinfo/biopython
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.