Skip to content

Proper error handling of convert engine command when file does not exist#1099

Open
hschilling wants to merge 12 commits intoOpenMDAO:mainfrom
hschilling:IA1004-convert-engine-error-message
Open

Proper error handling of convert engine command when file does not exist#1099
hschilling wants to merge 12 commits intoOpenMDAO:mainfrom
hschilling:IA1004-convert-engine-error-message

Conversation

@hschilling
Copy link
Copy Markdown
Member

Summary

The current behavior is that if a user does this command and the file turbofan_23k_1.eng does not exist in the current working directory

aviary convert_engine turbofan_23k_1.eng turbofan_23k_1.csv -f GASP

they get an error

File "/Users/hschilli/Documents/OpenMDAO/dev/IA1004-convert-engine-error-message/aviary/utils/engine_deck_conversion.py", line 452, in _read_header
    iread, iprint, wamap, t4max, t4mcl, t4mc, sfnidl = _parse(
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/hschilli/Documents/OpenMDAO/dev/IA1004-convert-engine-error-message/aviary/utils/conversion_utils.py", line 25, in _strparse
    yield typ(sub)
          ^^^^^^^^
ValueError: invalid literal for int() with base 10: '# cre'

This is because behind the scenes, Aviary searches for the file turbofan_23k_1.eng and any files "like" it to use as the input file. It finds

aviary/models/engines/turbofan_23k_1.csv

and tried to convert that, which fails.

This PR changes that behavior by not searching for a similar file. If the file requested does not exist, the user gets an error message saying it doesn't exist and the command fails.

Related Issues

Backwards incompatibilities

None

New Dependencies

None

Copy link
Copy Markdown
Member

@Kenneth-T-Moore Kenneth-T-Moore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but probably should add a test for the two new error messages.

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

Successfully merging this pull request may close these issues.

aviary convert_engine needs better error message when input deck file does not exist

2 participants