Why comes error when set a attribute to a cls type in Ryven?

Viewed 58

(English is not my native language)

It is a start use about Ryven, I just do pip install ryven and run ryven as the document say:

https://ryven.org/guide#/?id=flows

The version of python is 3.10.1 on linux.Version of ryven is 3.1.0.

When I click the button: CREATE NEW PROJECT.Error comes(just on linux,not come on windows):

Traceback (most recent call last):
  File "/home/user/PycharmProjects/mini_codes/ry_ven.py", line 14, in <module>
    ryven.run_ryven()
  File "/home/user/PycharmProjects/mini_codes/venv/lib/python3.10/site-packages/ryven/main/Ryven.py", line 75, in run
    editor = MainWindow(editor_init_config, window_title, window_theme, flow_theme, parent=gui_parent)
  File "/home/user/PycharmProjects/mini_codes/venv/lib/python3.10/site-packages/ryven/gui/main_window.py", line 70, in __init__
    self.import_nodes(path=abs_path_from_package_dir('main/nodes/built_in/'))
  File "/home/user/PycharmProjects/mini_codes/venv/lib/python3.10/site-packages/ryven/gui/main_window.py", line 340, in import_nodes
    self.session.register_nodes(nodes)
  File "/home/user/PycharmProjects/mini_codes/venv/lib/python3.10/site-packages/ryvencore/Session.py", line 39, in register_nodes
    self.register_node(n)
  File "/home/user/PycharmProjects/mini_codes/venv/lib/python3.10/site-packages/ryvencore/Session.py", line 46, in register_node
    node_class.build_identifier()
  File "/home/user/PycharmProjects/mini_codes/venv/lib/python3.10/site-packages/ryvencore/Node.py", line 66, in build_identifier
    cls.identifier = prefix + cls.identifier
TypeError: can only concatenate str (not "NoneType") to str

The error comes from file Node.py,source code below:

    @classmethod
    def build_identifier(cls):
        """
        sets the identifier to class name if it's not set, and adds the identifier prefix
        """

        prefix = ''
        if cls.identifier_prefix is not None:
            prefix = cls.identifier_prefix + '.'

        if cls.identifier is None:
            cls.identifier = cls.__name__

        cls.identifier = prefix + cls.identifier

        # notice that we do not touch the identifier compatibility fields

Finally get by doing debug:

If the cls.identifier is None,the codes's logic is to set the cls's attribute identifier as cls's __name__: identifier also be None after the code cls.identifier = cls.__name__.

Why?I do the codes to test:

class A():
    identiry: str = None


if __name__ == '__main__':
    cls = A

    if cls.identiry is None:
        cls.identiry = "hello"

    print(cls.identiry)


Comes out:

>>>hello

Why not successful just when setting attribute in Ryven? enter image description here

1 Answers

In case anyone runs into this: PySide2 seems broken on Python 3.10. Please use <=3.9 for now.

The issue was also reported on GitHub, Ryven 3.1.1 excludes Python 3.10

Related