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

.build() prints to stdout. Makes capturing output difficult. #24

Open
bac opened this issue Jan 17, 2020 · 2 comments
Open

.build() prints to stdout. Makes capturing output difficult. #24

bac opened this issue Jan 17, 2020 · 2 comments

Comments

@bac
Copy link
Contributor

bac commented Jan 17, 2020

The flowsynth build method on Model prints summary information to sys.stdout. It is awkward to actually get that output if you want to do something with it, e.g.

    # Flowsynth prints summary information directly to stdout. We must temporarily
    # redirect stdout in order to capture it.
    temp_stdout = io.StringIO()
    with contextlib.redirect_stdout(temp_stdout):
        fs_model.build()
    output = temp_stdout.getvalue()

It would be much more usable if the build method returned that data as a string. When flowsynth is called from the command-line it could simply print the results.

@whartond
Copy link
Collaborator

Makes sense. Do you want to submit a PR?

@bac
Copy link
Contributor Author

bac commented Jan 24, 2020

Sure. It will be a breaking change, though. You ok with that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants