I am running a script to uninstall a program and to finish the process, I am checking if the applicable directories get deleted as expected. I have the following:
D_PATHS = (
r'C:\ProgramFiles\D1\FolderA',
r'C:\ProgramFiles\D1\FolderB',
r'C:\ProgramFiles\D1\FolderC',
)
for path in D_PATHS:
self.info('Deleting %s', path)
if os.path.exists:
warnings.warn(f'The following directory still exists: {path}')
else:
print(f'Removed all required directories')
When I run the script, it always throws the warning that the directories still exist, even if they don't. What am I doing wrong? Please excuse my very limited knowledge of coding. I know there's probably an easy answer that I am not understanding.
Aucun commentaire:
Enregistrer un commentaire