Post #4827: Upon reviewing, I’ve noticed a few areas where misunderstandings seem to have oc
📋 Metadata
- Author: Pluglug
- Date: 2023-09-07 12:19:38
- Type:
answer - Quality Score: 8/10
- Reply to: post_04826
🏷️ Tags
python-scripting beginner solved
⚙️ Related PME Features
- Python Scripting
- Macro Editor
💬 Content
Upon reviewing, I’ve noticed a few areas where misunderstandings seem to have occurred. Let me explain in detail:
C.scene.tool_settings.uv_select_mode['VERTEX']
- Error: TypeError: string indices must be integers
- Since
uv_select_modeis a string, when indexing it, only integers can be used. Trying to use a string like'VERTEX'as an index is incorrect.
C.scene.tool_settings.uv_select_mode[VERTEX]
- Error: NameError: name ‘VERTEX’ is not defined
- Here,
VERTEXis not enclosed in single or double quotes, so Python interprets it as a variable. However, such a variable isn’t defined, which leads to an error.
Furthermore, the provided error message NameError: name 'EDGE' is not defined indicates a similar issue to the one described in the second point above.
Please recheck the usage of these strings: ['VERTEX', 'EDGE', 'FACE', 'ISLAND'], and ensure they’re correctly treated as strings. If the problem persists, we would appreciate more detailed information or provision of the relevant code.