Problem with script being invoked twice in BGE I want to launch vlc.exe when I hit spacebar in the BGE.

I have this script and it does the job:

import subprocess  
subprocess.call(['VLC\VLC.exe'])


The problem now, is that the script is invoked twice. It launches vlc and when I close the vlc instance, it launches it one more time. (I tried also with Tap option in the sensor)
This happens because there are two events for key down and key up. To choose one of them replace the print statement with your code to invoke and delete the other unneeded lines.

Script to test the behavior:

import bge

cont = bge.logic.getCurrentController()

sensor = cont.sensors['Space'] # Assumes that keyboard sensor is named as 'Space'
if sensor.getKeyStatus(bge.events.SPACEKEY) == bge.logic.KX_INPUT_JUST_ACTIVATED:
    print("sensor down")
if bge.logic.keyboard.events[bge.events.SPACEKEY] ==bge.logic.KX_INPUT_JUST_ACTIVATED:
    print("Down")
if sensor.getKeyStatus(bge.events.SPACEKEY) == bge.logic.KX_INPUT_JUST_RELEASED:
    print("Up")


One event picked

import bge
import subprocess

if bge.logic.keyboard.events[bge.events.SPACEKEY] ==bge.logic.KX_INPUT_JUST_ACTIVATED:
    subprocess.call(['C:\\path\\app.exe'])