So I have an overlay firefox extension with a python script I want to run when the user click a menu. My question is whether it is possible to run the script from the firefox extension? I did some research and found nsIProcess as a possible solution, but I couldn't get it to work with the code below. Any help is much appreciated.
replay: function(){
var file = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsIFile);
file.initWithPath("~/Library/Application Support/Firefox/Profiles/[profiles_name]/extensions/helloworld@xulschool.com/content/getInput.py");
var process = Components.classes["@mozilla.org/process/util;1"]
.createInstance(Components.interfaces.nsIProcess);
process.init(file);
var args = [];
process.run(false, args, args.length);
}
EDIT: So far I've managed to navigate to the python file without any problem, but when I try running it with process.run, I receive this error code:
NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIProcess.run]
I have no idea what caused this. Could it be my python code?