10

We have a preferences option to enable auto-run of python scripts when opening blend files. We can also add paths that are excluded from auto-running scripts. Then we have a cli options to enable or disable auto-running scripts and to bypass the startup.blend with --factory-startup.

In regard to auto-running scripts which of these options overrides all others?

If my startup.blend disables auto-run, can a python script be run from the cli to enable auto-run for the blend being opened?

Does --factory-startup bypass my auto-run settings?

ideasman42
  • 47,387
  • 10
  • 141
  • 223
sambler
  • 55,387
  • 3
  • 59
  • 192

1 Answers1

9

It seems that the order is as follows (in order from weakest to strongest):

  1. Startup .blend settings (does not override anything)

  2. --factory-startup will override all startup .blend preferences (including auto exec), but the default setting for auto exec is disabled (disallowing auto execution globally).

  3. -y (--enable-autoexec) enables
    -Y (--disable-autoexec) disables
    Both these options override the startup .blend auto exec preferences (including when used with --factory-startup) allowing auto execution. Note that it does not edit the preferences (even temporarily), it just allows execution.

  4. Running a script with -P (--python, --python-text, --python-expr) will execute the script immediately ignoring auto-execution settings. It is possible to enable auto-execution from such a script.

ideasman42
  • 47,387
  • 10
  • 141
  • 223
gandalf3
  • 157,169
  • 58
  • 601
  • 1,133
  • But it only allows to run the script given to -P, or does it also allow other scripts? I guess only that script is executed, but can probably import and execute others. Text datablocks registered as module shouldn't be allowed, only because a certain script was passed for execution.
  • – CodeManX Mar 11 '14 at 09:58
  • @CoDEmanX - clarified the -P behavior. – ideasman42 Mar 11 '14 at 15:09