mbrav / ansible-inventory-diagram

Script for generating infrastructure diagrams from Ansible inventory files
GNU General Public License v3.0
1 stars 1 forks source link

Cannot run using py -3.9 #1

Closed Ernestas-S closed 1 year ago

Ernestas-S commented 1 year ago

PS ansible-inventory-diagram> py -3.9 .\diagram\main.py Traceback (most recent call last): File "ansible-inventory-diagram\diagram\main.py", line 4, in from graph import InventoryGraph File "ansible-inventory-diagram\diagram\graph.py", line 8, in class AnsibleHost: File "ansible-inventory-diagram\diagram\graph.py", line 13, in AnsibleHost node: Node | None = None TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

mbrav commented 1 year ago

Hi, @Ernestas-S ! The | operand was added in python 3.10, so not available in python 3.9.

Version 3.10 or higher is required to run ansible-inventory-diagram. In case you need to install Python of any version I can recommend setting up pyenv and then installing the latest Python 3.10 version:

pyenv install 3.10.13
pyenv activate 3.10.13
Ernestas-S commented 1 year ago

I see, thank you for adding prerequisites for python requirements.

Also to be be able to run it with Python 3.9, one can add __future__ import annotations to the graph.py file.