System.Exec not executing the given command on key press

  • I have a key that I have programmed successfully in the past to turn on my AVR using cec-client. When I pass the command over ssh it turns the avr on. I ran "python .kodi/avr.py" and that too also turns on the avr.

    However when I pass the python script via the key, it doesn't turn on.

    Here is my python script located at /storage/.kodi/avr.py

    Code
    import os
    os.system('echo "on 4" | cec-client -s -d 1')

    Here is keymap:

    Code
    <keymap>
        <global>
            <keyboard>
                <key id="196">System.Exec(/storage/.kodi/avr.py)</key>
            </keyboard>
        </global>
    </keymap>

    Here is the debug log: