blender 2.8 malfunctions when reporting an indentation error executing a python script #68512

Closed
opened 2019-08-10 20:05:25 +02:00 by Robert Forsman · 11 comments

System Information
Operating system: Linux
Graphics card: NVIDIA Corporation GP106M [GeForce GTX 1060 Mobile]

Blender Version
Broken: version: 2.80 (sub 75), branch: master, commit date: 2019-07-29 14:47, hash: f6cb5f5449, type: Release
Worked: 2.79

when using the [Run Script] button in the text panel if the script has an indentation error the message sent to stdout (or stderr?) just says

AttributeError: 'IndentationError' object has no attribute 'msg'
Error: Python script failed, check the message in the system console

while older versions (like 2.79) would give a much more detailed message like

Error:   File "/triangle_anim_2.py", line 129
    def make_dot(loc, base, arm, i, mat):
      ^
IndentationError: expected an indented block

and highlight some text near the error in the text buffer

Exact steps for others to reproduce the error

try to run the following python script inside the editor:

def bacon():
    
def eggs():
    pass

**System Information** Operating system: Linux Graphics card: NVIDIA Corporation GP106M [GeForce GTX 1060 Mobile] **Blender Version** Broken: version: 2.80 (sub 75), branch: master, commit date: 2019-07-29 14:47, hash: f6cb5f54494e, type: Release Worked: 2.79 when using the [Run Script] button in the text panel if the script has an indentation error the message sent to stdout (or stderr?) just says ``` AttributeError: 'IndentationError' object has no attribute 'msg' Error: Python script failed, check the message in the system console ``` while older versions (like 2.79) would give a much more detailed message like ``` Error: File "/triangle_anim_2.py", line 129 def make_dot(loc, base, arm, i, mat): ^ IndentationError: expected an indented block ``` and highlight some text near the error in the text buffer **Exact steps for others to reproduce the error** try to run the following python script inside the editor: ``` def bacon(): def eggs(): pass ```
Author

Added subscriber: @mutantbob

Added subscriber: @mutantbob

Added subscriber: @snuq

Added subscriber: @snuq

Added subscribers: @ideasman42, @tintwotin

Added subscribers: @ideasman42, @tintwotin

Is it ok I tag you, as Text Editor module owner, on this report @ideasman42?

Is it ok I tag you, as Text Editor module owner, on this report @ideasman42?

I can't redo this error, in 2.80, I get the same behavior as 2.7x

Could you try run this:

print(IndentationError().msg)

I can't redo this error, in 2.80, I get the same behavior as 2.7x Could you try run this: `print(IndentationError().msg)`

Quite strangely everything works correctly when trying that line of code, but if I restart Blender and do the following I get the non descriptive indentation error:
indentation_error.gif

Quite strangely everything works correctly when trying that line of code, but if I restart Blender and do the following I get the non descriptive indentation error: ![indentation_error.gif](https://archive.blender.org/developer/F7673851/indentation_error.gif)

In #68512#756231, @tintwotin wrote:
Quite strangely everything works correctly when trying that line of code, but if I restart Blender and do the following I get the non descriptive indentation error:

yeah, thats where i ran into the error also, i had a subindented block with a 3 space indent instead of 4, and it was impossible to find - had to import the file into pycharm.

> In #68512#756231, @tintwotin wrote: > Quite strangely everything works correctly when trying that line of code, but if I restart Blender and do the following I get the non descriptive indentation error: yeah, thats where i ran into the error also, i had a subindented block with a 3 space indent instead of 4, and it was impossible to find - had to import the file into pycharm.

This quite annoying bug has also been reported here: blender/blender-addons#67295

This quite annoying bug has also been reported here: blender/blender-addons#67295

Added subscriber: @zgorg

Added subscriber: @zgorg

yes very annoying. the only way I found it's to go in pycharm and reformat text. it happens to me often after copy of text I think. maybe from another text editor but not quite sure. and after this is invisible in Blender text editor no way to see where indentation error is. and even deleting all space/tab before each line and being sure to put tab at each line is not enough...the error is still there but invisible. at first this is because a space as been introduced like the error is reporting. difficult to explain and reproduce but work a script under text editor and soon or later the error will appears. apparently devs are not using this. maybe it would be more advanced https://blenderartists.org/t/how-would-you-show-some-love-for-the-blender-text-editor/1163857/107

yes very annoying. the only way I found it's to go in pycharm and reformat text. it happens to me often after copy of text I think. maybe from another text editor but not quite sure. and after this is invisible in Blender text editor no way to see where indentation error is. and even deleting all space/tab before each line and being sure to put tab at each line is not enough...the error is still there but invisible. at first this is because a space as been introduced like the error is reporting. difficult to explain and reproduce but work a script under text editor and soon or later the error will appears. apparently devs are not using this. maybe it would be more advanced https://blenderartists.org/t/how-would-you-show-some-love-for-the-blender-text-editor/1163857/107

Closed as duplicate of blender/blender-addons#67295

Closed as duplicate of blender/blender-addons#67295
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
6 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#68512
No description provided.