Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add python dump_tree example for Mac #211

Merged
merged 4 commits into from
Apr 24, 2024
Merged

Add python dump_tree example for Mac #211

merged 4 commits into from
Apr 24, 2024

Conversation

alice
Copy link
Collaborator

@alice alice commented Apr 16, 2024

No description provided.

@alice alice requested a review from spectranaut April 16, 2024 06:12
Copy link
Collaborator

@spectranaut spectranaut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I discovered a weird problem with the python bindings! We will need to do more investigation.

examples/mac/dump_tree_axapi.py Show resolved Hide resolved
examples/mac/dump_tree_axapi.py Show resolved Hide resolved
case acacia_axapi.ValueType_NODE:
list = node.getNodeListValue(attribute)
case acacia_axapi.ValueType_STRING:
list = node.getStringListValue(attribute)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so I tried it -- I added to the ATTRIBUTES list on line 7... and we get some weird exceptions caught in line 83 above.

The error is: error: in method 'AXAPINode_getStringListValue', argument 2 of type 'std::string &'

I took a look at the generated file build/lib/mac/CMakeFiles/python_acacia_axapi.dir/acacia_axapiPYTHON_wrap.cxx, and it seems like the problem is with the attribute string...?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It took me a bit to figure out, but eventually I realised it's (for some reason) because those attribute getters took a std::string& rather than a const std::string& and somehow that caused an error when converting the Python attribute name string to the C++ string. Seems to work now! Thanks so much for catching this!

examples/mac/dump_tree_axapi.py Show resolved Hide resolved
examples/mac/dump_tree_axapi.py Show resolved Hide resolved
examples/mac/dump_tree_axapi.py Show resolved Hide resolved
case acacia_axapi.ValueType_NODE:
list = node.getNodeListValue(attribute)
case acacia_axapi.ValueType_STRING:
list = node.getStringListValue(attribute)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It took me a bit to figure out, but eventually I realised it's (for some reason) because those attribute getters took a std::string& rather than a const std::string& and somehow that caused an error when converting the Python attribute name string to the C++ string. Seems to work now! Thanks so much for catching this!

lib/mac/axapi_node.mm Outdated Show resolved Hide resolved
Copy link
Collaborator

@spectranaut spectranaut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome! thanks for figuring it out :)

@spectranaut spectranaut merged commit 18d1c86 into main Apr 24, 2024
2 checks passed
@alice alice deleted the mac-python branch May 3, 2024 03:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants