To be fair, shouldn’t you expect that behaviour?
This means that you should be catching an exception. Just not any
exception. The rule of thumb is that you should catch only what you
expect - other exceptions are “exceptional”, and you want them to get
out so that you can debug their cause.
So put back a try/except in your code, but be much more specific:
from logging import warning
df = Alteryx.read("#1")
except FileNotFOundError as e:
warning("missing file: %s", e)
There’s quite a range of quite specific exceptions: Built-in Exceptions — Python 3.9.6 documentation
The idea is that you should only handle expected situations. Unexpected
stuff need to make noise, otherwise your programme silently proceeds,
usually making nonsense of some kind.
Finally, sys.exit() is ok in a main programme (outside all functions).
Inside a function your almost never want to do that; instead you would
either raise an exception (which you could do by just not catching it)
or returning a special value indicating failure. If the above were in a
function you might return None if you chose that course - naturally
whataver called the function should know what to do with such a thing,
which is why an exception is often a preferred source of action.
Cameron Simpson firstname.lastname@example.org