Board index Scripting and Automation Writing a file: permission denied

Writing a file: permission denied

Running FileBot from the console, Groovy / FileBot scripting, shell scripts, etc


Posts: 2
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:

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:

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)

rednoah User avatar
The Source

Posts: 2083
Location: 北京

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:
-trust-script
FileBot is free software. Please help support FileBot by writing a review or considering a donation.
Image

rednoah User avatar
The Source

Posts: 2083
Location: 北京

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, ...)
FileBot is free software. Please help support FileBot by writing a review or considering a donation.
Image


Posts: 2
thank you both! I'll try to fix things later today.


Return to Scripting and Automation