xmind
raw JSON → 1.2.0 verified Fri May 01 auth: no python
XMind is a Python library for creating, parsing, and updating XMind mind map files. It supports XMind workbooks with topics, sheets, and relationships. Current version is 1.2.0, with an irregular release cadence. Requires Python 3.0 to 3.11 (not 3.12+). Note: This library is not actively maintained on PyPI; some features may be incomplete or buggy.
pip install xmind Common errors
error ModuleNotFoundError: No module named 'xmind' ↓
cause Library not installed or installed in wrong environment.
fix
Run 'pip install xmind' in your active Python environment.
error FileNotFoundError: [Errno 2] No such file or directory: 'test.xmind' ↓
cause Attempting to open a non-existent file with the Workbook constructor.
fix
Do not pass a path to Workbook if you intend to create a new file. Use 'workbook = xmind.Workbook()' for new files.
error AttributeError: 'NoneType' object has no attribute 'getTitle' ↓
cause Calling getTitle on a topic that is None. This can happen if the sheet has no root topic or if the path is incorrect.
fix
Ensure the workbook has a sheet with a root topic. Always check for None: 'if topic: print(topic.getTitle())'
Warnings
gotcha The library does not support Python 3.12+ due to setup.py restrictions. Use Python 3.10 or 3.11. ↓
fix Use Python 3.10 or 3.11, or fork and fix the setup.py to support newer Python.
gotcha The Workbook constructor can either take a file path to load an existing file or no argument to create a new one. However, calling it with a path that does not exist will raise a FileNotFoundError, not create a new file. ↓
fix Check if file exists before loading: 'from pathlib import Path; if Path('test.xmind').exists(): wb = xmind.Workbook('test.xmind'); else: wb = xmind.Workbook()'
deprecated The method 'setTitle' is used instead of 'set_title' in some examples. There is no official 'set_title' method. ↓
fix Use 'topic.setTitle("...")' not 'topic.set_title(...)'.
gotcha Saving a workbook may not work correctly if the directory does not exist. The library does not create directories automatically. ↓
fix Ensure the directory exists before calling 'save'.
Imports
- xmind
import xmind
Quickstart
import xmind
# Create a new workbook
workbook = xmind.Workbook()
sheet = workbook.getPrimarySheet()
topic = sheet.getRootTopic()
topic.setTitle("Main Topic")
# Save to file
workbook.save("test.xmind")
print("Saved as test.xmind")
# Load an existing workbook
loaded = xmind.Workbook("test.xmind")
loaded_sheet = loaded.getPrimarySheet()
loaded_topic = loaded_sheet.getRootTopic()
print("Root topic:", loaded_topic.getTitle())