You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, i noticed this module doesn't support subprocess's CalledProcessError exception, ad the CalledProcess variable it has isn't an exception class (my compiler, pyright says so). How do I use this for try-catch code?
The code in question (Python 3)
def run_yay(cmd_args: str, pkg: str):
"""Runs yay
Keyword Arguments:
cmd_args -- The arguments passed to pacman
pkg -- The packages to be installed
"""
try:
sb.run(
["yay %s %s" % (cmd_args, pkg)],
stdout=sb.PIPE,
stderr=sb.PIPE,
shell=True,
check=True,
)
except sb.CalledProcessError as e:
logging.critical("Yay has run into an issue installing! Cannot continue!")
logging.critical("Error Code: " + str(e.returncode))
exit(1)
else:
logging.info(
"Yay finished running with args: [" + cmd_args + "] and pkg: [" + pkg + "]"
)
This discussion was converted from issue #54 on November 24, 2022 23:35.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hey, i noticed this module doesn't support
subprocess
'sCalledProcessError
exception, ad theCalledProcess
variable it has isn't an exception class (my compiler, pyright says so). How do I use this for try-catch code?The code in question (Python 3)
Beta Was this translation helpful? Give feedback.
All reactions