Commit 3f14a83
authored
Update _axclrt.py (#36)
After investigating the issue, I found that the current code directly assigns the C pointer returned from the AxcrustEngineGetOutputNameByIndex function to the name variable. This causes Python to display the raw C pointer address (e.g., <cdata 'char *' 0x8820f70>) instead of the actual string value.
The proper solution involves a two-step process:
First, store the C pointer in a variable named cffi_name
Then, convert the C pointer to a string using axclrt_cffi.string() and decode it as a UTF-8 string with decode("utf-8")
This modification ensures that C string pointers are properly converted to Python strings, allowing the correct names to appear in the output results. This approach is consistent with the method already used in the _get_inputs() method.
Before change:
axengine/_axclrt.py LineNo.279
name = axclrt_lib.axclrtEngineGetOutputNameByIndex(self._info[0], index)
After change:
axengine/_axclrt.py LineNo.279
cffi_name = axclrt_lib.axclrtEngineGetOutputNameByIndex(self._info[0], index)
name = axclrt_cffi.string(cffi_name).decode("utf-8")1 parent 0c655ac commit 3f14a83
1 file changed
+2
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
279 | | - | |
| 279 | + | |
| 280 | + | |
280 | 281 | | |
281 | 282 | | |
282 | 283 | | |
| |||
0 commit comments