You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In our plug-ins we've been doing context[:] to get a copy of the instances list from the context, though in Python 3.6 this is giving us the following error:
Traceback (mostrecentcalllast):
File"<stdin>", line1, in<module>File"D:\pyblish-base\pyblish\plugin.py", line771, in__getitem__raiseKeyError("%s not in list"%item)
KeyError: 'slice(None, None, None) not in list'
Confirmed and reproducable with:
importpyblish.apiasapic=api.Context()
print(c[:])
This works in Python 2.7 - but raises the error above in Python 3.6.
Workaround
It does however work when doing list(context) to get a copy of the list.
Allows the slicing to function as in a regular Python list in both Python 2.7 and Python 3.6.
Why it's working without this in Python 2.7 on the other hand makes me confused now.
It seems in Python 2.7 that with slicing it never enters the __getitem__ function. :)
Issue
In our plug-ins we've been doing
context[:]
to get a copy of the instances list from the context, though in Python 3.6 this is giving us the following error:Confirmed and reproducable with:
This works in Python 2.7 - but raises the error above in Python 3.6.
Workaround
It does however work when doing
list(context)
to get a copy of the list.Shouldn't the first one also work if it "should behave" like a regular list?
The text was updated successfully, but these errors were encountered: