Invalid first argument to register()
. ForwardRef('PredictedInstance') is not a class.
#968
Labels
bug
Something isn't working
In Python 3.9+, it looks like cattrs breaks when structuring forward references. At the moment this only affects M1 Macs which will use Python 3.9 environments by default, but will be an issue across all platforms in the future.
This crops up when loading a project that has an instance created from predictions such that the
Instance.from_predicted
field is notNone
(i.e., set to aPredictedInstance
). Here's where this is handled:sleap/sleap/instance.py
Lines 1228 to 1249 in be89412
This can be worked around using the approach described in python-attrs/cattrs#206.
See below for original user post that reported this.
Discussed in #966
Originally posted by gaojundong September 20, 2022
Hi Team,
When I try to save the skeleton instance as a new project, a window suddenly popped up to remind me:
An error occured when attempting to save:
Invalid first argument to
register()
. ForwardRef('PredictedInstance') is not a class.Try saving your project with a different filename or in a different format.
I try to modify the file name as label.slp and label.v001.slp, but it still doesn't work. this is my software version:
Software versions:
SLEAP: 1.2.8
TensorFlow: 2.9.2
Numpy: 1.22.3
Python: 3.9.13
OS: macOS-12.5.1-arm64-arm-64bit
In this software, I can save skeleton node and edges and export video, but I don't know where is the problem when I save the whole project. Can you give me some hints about this. Thank you very much.
All the best,
Gaojun
The text was updated successfully, but these errors were encountered: