Cut/paste to the python console reports indentation errors when empty lines in code #52288

Closed
opened 2017-08-07 20:52:30 +02:00 by Gaia Clary · 9 comments
Member

Take for example this silly piece of code:

def xyz(v):
   
    for i in range(v):
        print(i)
       
xyz(3)

This is a valid python snippet. However when you paste it to the python console, then you get an indentation error right after the empty line.
I added a diff (a one line change actually) as a possible first idea for improvement:

https://developer.blender.org/D2777

Please can you inspect and give feedback and possibly advise how this can be made better ?

Take for example this silly piece of code: ``` def xyz(v): for i in range(v): print(i) xyz(3) ``` This is a valid python snippet. However when you paste it to the python console, then you get an indentation error right after the empty line. I added a diff (a one line change actually) as a possible first idea for improvement: https://developer.blender.org/D2777 Please can you inspect and give feedback and possibly advise how this can be made better ?
Gaia Clary self-assigned this 2017-08-07 20:52:30 +02:00
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'
Author
Member

Added subscriber: @GaiaClary

Added subscriber: @GaiaClary

Added subscriber: @ideasman42

Added subscriber: @ideasman42

Pasting this into Python's own console also doesn't work.

Think it may be best to execute this as a single block of code: see https://docs.python.org/3/library/code.html#code.compile_command

Pasting this into Python's own console also doesn't work. Think it may be best to execute this as a single block of code: see https://docs.python.org/3/library/code.html#code.compile_command

Added subscriber: @Sergey

Added subscriber: @Sergey
Gaia Clary was unassigned by Sergey Sharybin 2017-08-08 14:59:28 +02:00
Campbell Barton was assigned by Sergey Sharybin 2017-08-08 14:59:28 +02:00

I've just copy-pasted the code to Blender's console and it just worked in both current master version and 2.78c.. Is it platform-dependent?

@ideasman42, is it considered a bug?

I've just copy-pasted the code to Blender's console and it just worked in both current master version and 2.78c.. Is it platform-dependent? @ideasman42, is it considered a bug?

Added subscriber: @dfelinto

Added subscriber: @dfelinto

Changed status from 'Confirmed' to: 'Archived'

Changed status from 'Confirmed' to: 'Archived'

Hi, thanks for your patch.

We are undergoing a Tracker Curfew where we are automatically closing old patches.

If you think the patch is still relevant please update and re-submit it. For new features make sure there is a clear design from the user level perspective.

Hi, thanks for your patch. We are undergoing a [Tracker Curfew ](https://code.blender.org/?p=3861) where we are automatically closing old patches. If you think the patch is still relevant please update and re-submit it. For new features make sure there is a clear design from the user level perspective.
Sign in to join this conversation.
No Milestone
No project
No Assignees
4 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-addons#52288
No description provided.