[Biopython] GFF3 manipulation

Adam Sjøgren asjo at koldfront.dk
Sun Jun 30 10:02:40 UTC 2019


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."                            asjo at koldfront.dk



More information about the Biopython mailing list