I use the pip module in a python script to automate the installation of software / modules . How can I do to check if the (remote) software / module exists? I have found nothing in the pip module that allows to do that.
My code :
class install_pip:
def __init__(self):
self._liste=['install']
def install(self):
pip.main(self._liste)
def addsoftware(self, software):
if type(software) is str:
self._liste.append(software)
if type(software) is list:
for i in software:
self._liste.append(i)
def delsoftware(self, software):
if type(software) is str:
self._liste.remove(software)
if type(software) is list:
for i in software:
self._liste.remove(i)
def _return(self):
return self._liste[1:len(self._liste)]
list = property(_return)
I want check if 'software' exist. Thanks.
Edit: I tried this code:
try:
pip.main(['install', 'nonexistentpackage'])
except pip.InstallationError as err:
print(echec)
But I dont get any error...