For example I want to check does py-sqlite3 available..? One of the methods would to call that command with some minimum python script and catch error?
I want to make check for any linux distro and unix system (at least bsd)
What could be the best way to achieve this?
P.s. Please provide example of shell scripting error catching, because I'm not so advanced in shell scripting
In bash:
and then you can use it like this:
This would be easy to do with Python.
Exits with
return code 0
if it can import it, orreturn code 1
if it cannot.Andrew
I have found existing answers incomplete and lacking good enough examples. Here is the solution I have settled on:
A Github gist of this example can be found here: https://gist.github.com/shaypal5/d505af9953cd86f59c750fa600ee4ba6