0
import subprocess
first_command: str = input("Hello sir. Would you like for me to do anything?> ")
if str(first_command) == str("JARVIS Open Spotify" or "Hey Jarvis open spotify" or "Open spotify" or "launch spotify"):
    subprocess.Popen(r"C:\Users\Administrator\Downloads\Spotify.exe

(sorry if this is a stupid question ive just started programming)

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
ohno
  • 1
  • 1
  • Your question isn't clear. Do you want help with setting configuration to run the file in Pycharm? – Hatim Nov 04 '21 at 18:18
  • 1) You have a SyntaxError in the `Popen` call 2) Duplicate: [How to test multiple variables against a single value?](https://stackoverflow.com/questions/15112125/how-to-test-multiple-variables-against-a-single-value) – OneCricketeer Nov 04 '21 at 19:33

1 Answers1

0

First of all, your if statement is not correct, or not what I assume you intend it to be like.

The input() function always returns a string, so there is no need to use the str(...) beforehand.

Secondly, this statement also returns the first str (from left to right) that is not empty. So

"JARVIS Open Spotify" or "Hey Jarvis open spotify" or "Open spotify" or "launch spotify"

Is just "JARVIS Open Spotify". Again, no need to use the str builtin.

Lastly, this is not the path for the Spotify.exe, I assume you tried to copy the path with ctrl+shift+c or similar command. The default executable can be found under C:\Users\<Your_User>\Local\Microsoft\WindowsApps\Spotify.exe

Try to search for Spotify.exe, hold shift, right click on the Spotify.exe and click on copy as path

CodeCop
  • 1
  • 2
  • 15
  • 37