TypeError when autocompleting bpy.app.something #49342

Closed
opened 2016-09-13 17:05:40 +02:00 by Sybren A. Stüvel · 13 comments

System Information
Kubuntu Linux 16.04

Blender Version
Broken: master (blender/blender@f38f787448) and 2.78-rc1
Worked: 2.77a

Short description of error

When autocompleting bpy.app.something I get this error:

Traceback (most recent call last):

File "/home/sybren/workspace/blender-git/build_linux/bin/release/scripts/modules/console_python.py", line 264, in autocomplete
private=bpy.app.debug_python)
File "/home/sybren/workspace/blender-git/build_linux/bin/release/scripts/modules/console/intellisense.py", line 129, in expand
matches, word = complete(line, cursor, namespace, private)
File "/home/sybren/workspace/blender-git/build_linux/bin/release/scripts/modules/console/intellisense.py", line 90, in complete
matches = complete_namespace.complete(word, namespace, private)
File "/home/sybren/workspace/blender-git/build_linux/bin/release/scripts/modules/console/complete_namespace.py", line 154, in complete
matches = complete_names(word, namespace)
File "/home/sybren/workspace/blender-git/build_linux/bin/release/scripts/modules/console/complete_namespace.py", line 61, in complete_names
completer.complete(word, 0)
File "/usr/lib/python3.5/rlcompleter.py", line 89, in complete
self.matches = self.attr_matches(text)
File "/usr/lib/python3.5/rlcompleter.py", line 147, in attr_matches
words = set(dir(thisobject))

TypeError: unorderable types: tuple() < str()

Exact steps for others to reproduce the error

  1. Start Blender
  2. Press Shift+F4 to open script window
  3. Type bpy.app.b and then the "Autocomplete" button/hotkey TWICE (first time it's ok)
  4. See the error
**System Information** Kubuntu Linux 16.04 **Blender Version** Broken: master (blender/blender@f38f787448) and 2.78-rc1 Worked: 2.77a **Short description of error** When autocompleting `bpy.app.something` I get this error: ```lang=python Traceback (most recent call last): ``` File "/home/sybren/workspace/blender-git/build_linux/bin/release/scripts/modules/console_python.py", line 264, in autocomplete private=bpy.app.debug_python) File "/home/sybren/workspace/blender-git/build_linux/bin/release/scripts/modules/console/intellisense.py", line 129, in expand matches, word = complete(line, cursor, namespace, private) File "/home/sybren/workspace/blender-git/build_linux/bin/release/scripts/modules/console/intellisense.py", line 90, in complete matches = complete_namespace.complete(word, namespace, private) File "/home/sybren/workspace/blender-git/build_linux/bin/release/scripts/modules/console/complete_namespace.py", line 154, in complete matches = complete_names(word, namespace) File "/home/sybren/workspace/blender-git/build_linux/bin/release/scripts/modules/console/complete_namespace.py", line 61, in complete_names completer.complete(word, 0) File "/usr/lib/python3.5/rlcompleter.py", line 89, in complete self.matches = self.attr_matches(text) File "/usr/lib/python3.5/rlcompleter.py", line 147, in attr_matches words = set(dir(thisobject)) ``` TypeError: unorderable types: tuple() < str() ``` **Exact steps for others to reproduce the error** 1. Start Blender 2. Press Shift+F4 to open script window 3. Type `bpy.app.b` and then the "Autocomplete" button/hotkey TWICE (first time it's ok) 4. See the error
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'
Author
Member

Added subscriber: @dr.sybren

Added subscriber: @dr.sybren

Added subscriber: @Stranger6667

Added subscriber: @Stranger6667

Some info about this bug.

It is because version attribute value exists in object attributes names (along with version attribute name)

>>> [item for item in bpy.app.__dir__() if not isinstance(item, str)]

[(2, 78, 0)]

and dir sorts attributes names alphabetically.
This happens only after autocomplete usage (I also tried with bpy.app.b).

Same code for 2.77

>>> [item for item in bpy.app.__dir__() if not isinstance(item, str)]

[]

Bisection result:

f5e020a7a6ad6451fcaf075ae14f7014b8a4faea is the first bad commit
commit f5e020a7a6ad6451fcaf075ae14f7014b8a4faea
Author: Campbell Barton <ideasman42@gmail.com>
Date:   Thu Jul 14 17:28:28 2016 +1000

    PyAPI: fix memory leaks in dictionary assignment

    Thanks to Kévin Dietrich for spotting driver leak,
    checked other uses of PyDict_SetItem and found more.

:040000 040000 ef233e5143b6aa10ea8b2f92545d96839c65d35f ab10c41ec8dbf93f86cb0cd8b9f599209b5b8c1d M	source

Reproducible test:

def test_T49342():
    bpy.app.binary_path_python
    dir(bpy.app)

access to this attribute causes the error. Other attributes are ok

Some info about this bug. It is because `version` attribute **value** exists in object attributes names (along with `version` attribute name) ``` >>> [item for item in bpy.app.__dir__() if not isinstance(item, str)] [(2, 78, 0)] ``` and `dir` sorts attributes names alphabetically. This happens only after autocomplete usage (I also tried with `bpy.app.b`). Same code for 2.77 ``` >>> [item for item in bpy.app.__dir__() if not isinstance(item, str)] [] ``` Bisection result: ``` f5e020a7a6ad6451fcaf075ae14f7014b8a4faea is the first bad commit commit f5e020a7a6ad6451fcaf075ae14f7014b8a4faea Author: Campbell Barton <ideasman42@gmail.com> Date: Thu Jul 14 17:28:28 2016 +1000 PyAPI: fix memory leaks in dictionary assignment Thanks to Kévin Dietrich for spotting driver leak, checked other uses of PyDict_SetItem and found more. :040000 040000 ef233e5143b6aa10ea8b2f92545d96839c65d35f ab10c41ec8dbf93f86cb0cd8b9f599209b5b8c1d M source ``` Reproducible test: ``` def test_T49342(): bpy.app.binary_path_python dir(bpy.app) ``` access to this attribute causes the error. Other attributes are ok

Added subscribers: @Sergey, @mont29

Added subscribers: @Sergey, @mont29

@Stranger6667 Thanks for investigation… blender/blender@f5e020a7a6

However, I cannot confirm this behavior here with own build, neither from master nor 2.78 branch, neither in debug build or release build :|

This may be a python version thing… @Sergey if I am correct, official builds use python 3.5.1 right? While here am using system 3.5.2 one…

@Stranger6667 Thanks for investigation… blender/blender@f5e020a7a6 However, I cannot confirm this behavior here with own build, neither from master nor 2.78 branch, neither in debug build or release build :| This may be a python version thing… @Sergey if I am correct, official builds use python 3.5.1 right? While here am using system 3.5.2 one…
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

note: first occurance/autocomplete after a fresh restart of blender goes through without the error, only then (second/third) the error happens

note: first occurance/autocomplete after a fresh restart of blender goes through without the error, only then (second/third) the error happens
Bastien Montagne self-assigned this 2016-09-14 10:27:06 +02:00

Ah crap, yeah, you are right, can reproduce it too now :/

Ah crap, yeah, you are right, can reproduce it too now :/
Author
Member

Edit: I can't read

Edit: I can't read

OK, so actual regression is from blender/blender@036c006cef, which fixes crash introduced by blender/blender@f5e020a7a6…

OK, so actual regression is from blender/blender@036c006cef, which fixes crash introduced by blender/blender@f5e020a7a6…

This issue was referenced by blender/blender@ce952fd36e

This issue was referenced by blender/blender@ce952fd36e547620a9edb53ccc045536af37ddbe

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sign in to join this conversation.
No Milestone
No project
No Assignees
5 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#49342
No description provided.