'Can`t open files/programs in python

I'm making a voice assistance type program and I wanted the user to be able to open any program on their computer but most methods I'm using don't work or I missing something out. Every time I run the code and chose the option to open a certain program the terminal tells me:

"The system couldn't find the specified file."

#Opens any applications in the system
elif 'open' in command:
        command = command.replace("open","")
        os.startfile(command+".exe")

Thanks for the help in advance



Solution 1:[1]

You can use it but you are trying to find a file, not a Program. Now you only need to name the Program

Try:

elif 'open' in command:
        command = command.replace("open","")
        os.start(command)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Armatorix