"Use Self" option for drivers throws error unless "Auto Run Python Scripts" is turned on in preferences #118274

Closed
opened 2024-02-14 14:21:00 +01:00 by Erindale · 2 comments

System Information
Operating system: Windows-10-10.0.22000-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 3080/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 551.23

Blender Version
Broken: version: 4.0.2, branch: blender-v4.0-release, commit date: 2023-12-05 07:41, hash: 9be62e85b727
Worked: (newest version of Blender that worked as expected)

Short description of error
When trying to run a driver using the self target, the error "Invalid Python Expression" is shown.
The console prints "BPY_driver_exec: restricted access disallows name 'self', enable auto-execution to support"
After turning on Auto Run Python Scripts in the Save & Load preferences the self name will work in drivers but show the info "Slow Python Expression".

This is not pointed out in the documentation: https://docs.blender.org/manual/en/latest/animation/drivers/drivers_panel.html
A better solution would be to have the tooltip change from invalid expression to be something more informative eg "enable auto-execution to support use self", or better still, just not having the self function stuck behind a boolean that most would not want to turn on by default.

Exact steps for others to reproduce the error

  1. Add a new object.
  2. Add a driver to the Y rotation.
  3. Set driver as self.location.x and toggle Use Self.
  4. The driver will error.
  5. In preferences, Save & Load turn on Auto Run Python Scripts.
  6. Click into and reconfirm the driver.
  7. Error should update to "Slow Python Expression" and now work.

Edit: It appears that the self name does not work on things such as light power as the error just remains "invalid Python Expression"

**System Information** Operating system: Windows-10-10.0.22000-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 3080/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 551.23 **Blender Version** Broken: version: 4.0.2, branch: blender-v4.0-release, commit date: 2023-12-05 07:41, hash: `9be62e85b727` Worked: (newest version of Blender that worked as expected) **Short description of error** When trying to run a driver using the self target, the error "Invalid Python Expression" is shown. The console prints "BPY_driver_exec: restricted access disallows name 'self', enable auto-execution to support" After turning on Auto Run Python Scripts in the Save & Load preferences the self name will work in drivers but show the info "Slow Python Expression". This is not pointed out in the documentation: https://docs.blender.org/manual/en/latest/animation/drivers/drivers_panel.html A better solution would be to have the tooltip change from invalid expression to be something more informative eg "enable auto-execution to support use self", or better still, just not having the self function stuck behind a boolean that most would not want to turn on by default. **Exact steps for others to reproduce the error** 1. Add a new object. 2. Add a driver to the Y rotation. 3. Set driver as `self.location.x` and toggle Use Self. 4. The driver will error. 5. In preferences, Save & Load turn on Auto Run Python Scripts. 6. Click into and reconfirm the driver. 7. Error should update to "Slow Python Expression" and now work. Edit: It appears that the self name does not work on things such as light power as the error just remains "invalid Python Expression"
Erindale added the
Status
Needs Triage
Priority
Normal
Type
Report
labels 2024-02-14 14:21:01 +01:00
Iliya Katushenock added the
Interest
Animation & Rigging
Interest
Python API
labels 2024-02-14 14:22:56 +01:00
Author

I appreciate this is not exactly a bug as it technically works where it's designed to but it's sufficiently hidden behaviour with sufficiently obscure error messaging in the UI that it's essentially not working from a UX stand point. A quick google brings up years worth of people having the same question and most finding no resolution.

I appreciate this is not exactly a bug as it technically works where it's designed to but it's sufficiently hidden behaviour with sufficiently obscure error messaging in the UI that it's essentially not working from a UX stand point. A quick google brings up years worth of people having the same question and most finding no resolution.
Member

@Erindale hi, this is already discussed in #106372, closing as duplicate

@Erindale hi, this is already discussed in #106372, closing as duplicate
Blender Bot added
Status
Archived
and removed
Status
Needs Triage
labels 2024-02-15 06:26:54 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#118274
No description provided.