I am trying to invoke python from within an arch linux PKGBUILD script:
python -c "from module import func; func()"
The func
raises an exception, which is expected behavior but causes the script to fail.
Catching the exception like this does not work:
python -c "from module import func; try: func(); except ValueError: pass"
It seems there is no way to put try/except statements into a single line (Python: try statement in a single line).
Is there another way to ignore the exception or the fact that python returns with an error? A solution that does not require additional scripts or other files would be most welcome :)