Skip to content

Try-catch os.popen() for command failures - #1214

Open
RA80533 wants to merge 1 commit into
mkleehammer:masterfrom
RA80533:patch-2
Open

Try-catch os.popen() for command failures#1214
RA80533 wants to merge 1 commit into
mkleehammer:masterfrom
RA80533:patch-2

Conversation

@RA80533

@RA80533 RA80533 commented Apr 27, 2023

Copy link
Copy Markdown
Contributor

Fixes #1213

Comment thread setup.py
try:
cflags, ldflags = pipe.readlines()
except ValueError: # The command failed
cflags, ldflags = '', ''

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I assume the patch is setting cflags and ldflags to empty strings in the except block because you want to guard against another exception in the case in which we end up in the exit_status is None block. Presumably that would happen if odbc_config was found but produced malformed output for some reason. In that case wouldn't it be preferable to at least warn the user about the problem, if not abort the script altogether with an appropriate error message? You could set cflags and ldflags to None and then test them in the if exit_status is None` block.

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.

setup.py fails if odbc_config can't be found

2 participants