Skip to content

Unexpected behavior writing to existing IOStream #1168

@jariji

Description

@jariji

I don't understand this result.

import CSV

julia> open("tmp.csv", write=true) do io
           println(io, "# comment 1")
           println(io, "# comment 2")
           CSV.write(io, [(;a=1, b=2), (;a=10, b=20)])
       end
IOStream(<file tmp.csv>)

julia> println(read("tmp.csv", String))
a,b
1,2
10,20
comment 2

With append=true I'd expect

# comment 1
# comment 2
1,2
10,20

and with append=false (the default) I'd expect

a,b
1,2
10,20

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions