#
#
# .2020-06-26 16:59:01
Python
# ., 2020-06-26 16:59:01

How to view all installed programs on the computer and the paths to them, and then write them into the dictionary?

I am writing a voice assistant. I need to transfer it to another device, but the problem is that I wrote down the paths to the programs that the assistant opens on command. I need to find out all installed programs on the computer and record the name and path of this program in a dictionary. I tried to do it with "Winapps" library like this:

import winapps

for app in winapps.list_installed():
    print(app)

The output of this program can be written to the dictionary, but through the "dance with bubo", in addition, after the program is executed, an error is generated: ValueError: time data '5/6/2020' does not match format '%Y%m%d'
Screen :
5ef5fe8dd9b54867259975.png
Are there other ways to do this?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2020-06-26
@andro1

import os
soft_list = []
#64-bit
for lf in os.listdir('C:\\Program Files'):
if not os.path.file(lf):
soft_list.append(lf)
#32-bit
for lf in os.listdir('C:\\Program Files (x86)'):
if not os.path.file(lf):
soft_list.append(lf)
for sl in soft_list:
print(sl)

D
Dimonchik, 2020-06-26
@dimonchik2013

list_installed() to the dictionary is redone at the moment

a '5/6/2020' does not match format '%Y%m%d'

locales yes, you need to follow, you can normalize to one by
post-processing, you can fix the code
https://github.com/rominf/winapps/blob/master/wina...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question