amusecode / amuse

Astrophysical Multipurpose Software Environment. This is the main repository for AMUSE
http://www.amusecode.org
Apache License 2.0
152 stars 98 forks source link

suppress output? #1008

Closed cconroy20 closed 8 months ago

cconroy20 commented 8 months ago

Is it possible to suppress the text printed to stdout of the form: "In this session you have used the AMUSE modules below...." It's cluttering up the output information that I'm trying to print to stdout. thanks Charlie

rieder commented 8 months ago

yes, run your script as python script.py --no-report-references.

rieder commented 8 months ago

note that we may change this in the future - it is non-documented behaviour and may fail, e.g. when using an argparse/optparse instance.

cconroy20 commented 8 months ago

Indeed, I have modified the evolution_cluster script to take inputs via argparse, and so this suggestion fails. When I remove my argparse modifications, then the option "--no-report-references" does work as suggested. Any ideas for how to get this option to work with additional user-defined input arguments? thanks

rieder commented 8 months ago

Making a 'default' list of arguments to parse is on the to-do list, but has been for a while... The relevant code is in src/amuse/support/literature.py, line 124.

You could add a dummy argument to your argparser: parser.add_argument('--no-report-references', dest='do_not_report_references', action='store_true')

cconroy20 commented 8 months ago

that worked - thanks again!