Page 1 of 1

Writing a file: permission denied

Posted: 17 Mar 2012, 18:02
by SeeDoubleYou
I want filebot to run each time qBittorent is done with a new file. qBittorent offers a feature for this. I call a groovyscript with filebot. When I do this from commandline it works perfectly, but not from qBittorent. So To do some testing I wanted to check whether the script runs by writing the arguments it gets to a file. Still with me? Ok then. To do this I added the following to my script:

Code: Select all

File file = new File("/home/myusername/funbottest")
file.write("test")
To test this I ran the script via filebot through commandline. Then I get this error:

Code: Select all

AccessControlException: access denied ("java.io.FilePermission" "/home/myusername/funbottest" "write")
java.security.AccessControlException: access denied ("java.io.FilePermission" "/home/myusername/funbottest" "write")
	at sdy.media.MR.run(Script3.groovy:6)
	at sdy.media.MR$run.call(Unknown Source)
	at sdy.media.Script3.run(Script3.groovy:12)
	at net.sourceforge.filebot.cli.ScriptShell$2.run(Unknown Source)
	at net.sourceforge.filebot.cli.ScriptShell.evaluate(Unknown Source)
	at net.sourceforge.filebot.cli.ScriptShell.run(Unknown Source)
	at net.sourceforge.filebot.cli.ScriptShell.run(Unknown Source)
	at net.sourceforge.filebot.cli.ArgumentProcessor.process(Unknown Source)
	at net.sourceforge.filebot.Main.main(Unknown Source)
Failure (°_°)
When I run the script directly from Eclipse it works without a problem.

This is Ubuntu 11.10 with java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)

Re: Writing a file: permission denied

Posted: 17 Mar 2012, 18:38
by rednoah
Scripts are sandboxed by default and only allows trusted functions like rename() to mess with your files.

Add -trust-script flag to run Groovy code without any restrictions:

Code: Select all

-trust-script

Re: Writing a file: permission denied

Posted: 17 Mar 2012, 18:49
by rednoah
SeeDoubleYou wrote:So To do some testing I wanted to check whether the script runs by writing the arguments it gets to a file.
btw be careful with "custom arguments". That doesn't work. The filebot cmdline call has to be valid arguments, so you can't specify extra cmdline options. Also all the arguments you add in addition to options will all be considered to be filepaths.

args is File[] of extra arguments/filepaths that are not options/flags
_args is FileBot options (e.g. _args.lang, _args.format, ...)

Re: Writing a file: permission denied

Posted: 18 Mar 2012, 14:26
by SeeDoubleYou
thank you both! I'll try to fix things later today.