Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] File open does not have the append flag #3849

Open
martinvuyk opened this issue Dec 9, 2024 · 0 comments
Open

[BUG] File open does not have the append flag #3849

martinvuyk opened this issue Dec 9, 2024 · 0 comments
Labels
bug Something isn't working mojo-repo Tag all issues with this label

Comments

@martinvuyk
Copy link
Contributor

martinvuyk commented Dec 9, 2024

Bug description

File open does not have the append flag.

Steps to reproduce

This works in python but doesn't in Mojo

from os import remove

def main():
    name = "some_file.txt"

    with open(name, "w") as f:
        f.write("new contents 🔥")

    with open(name, "r") as f:
        contents = f.read()
        print(contents)

    with open(name, "a") as f:
        f.write("add another fire 🔥")

    with open(name, "r") as f:
        contents = f.read()
        print(contents)
    
    remove(name)

This is a compiler issue :

var handle = external_call[
    "KGEN_CompilerRT_IO_FileOpen", OpaquePointer
](path, mode, Pointer.address_of(err_msg))

System information

- Provide version information for Mojo by pasting the output of `mojo -v`
`mojo 24.6.0.dev2024120805`
@martinvuyk martinvuyk added bug Something isn't working mojo-repo Tag all issues with this label labels Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mojo-repo Tag all issues with this label
Projects
None yet
Development

No branches or pull requests

1 participant