'macOS - Custom protocol handler is not executing python script provided in the Application

I have created protocol handler application to handle custom protocol. I have followed the steps mentioned in OSX : Defining a new URL handler that points straight at a Python script . I see my application being launched when I run "myTestProto://abc?param1=1&param2=2" from the browser but the python script included in the application is not executed.

on open location this_URL
   do shell script "/scripts/myTestProto.py '" & this_URL & "'"
end open location

enter image description here

Am I missing something? Any help is much appreciated.

This works if I add "python" and provide full path of python script file as shown below

on open location this_URL
   do shell script "python /Users/demouser/myTestProto.app/Contents/Resources/Scripts/myTestProto.py '" & this_URL & "'"
end open location

How to make the protocol handler execute the python script using relative path?



Sources

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

Source: Stack Overflow

Solution Source