Closed hemebond closed 1 month ago
It was easy to "fix":
diff --git a/lib/godot/_python_extension/editor/export_plugin.py b/lib/godot/_python_extension/editor/export_plugin.py
index c09c954..427f563 100644
--- a/lib/godot/_python_extension/editor/export_plugin.py
+++ b/lib/godot/_python_extension/editor/export_plugin.py
@@ -67,6 +67,7 @@ def _get_target_platform_lib(platform, arch) -> pathlib.Path:
else:
path = gdextension_path.parent / path
+ path = pathlib.Path(path)
if path.exists():
return path
Unfortunately the exported binary doesn't run so I'm guessing the export business is still in development
terminate called after throwing an instance of 'pybind11::error_already_set'
what(): ModuleNotFoundError: No module named 'godot'
Aborted
Hmm, I did have export working for Linux and Windows, tho it's a little rough. Maybe something has changed in Godot since I last tested exporting.
Some questions / notes:
godot
module should be embedded in the extension shared object, so I wonder at what point it fails at.I'm on Debian Linux (Testing) x86_64 trying to export to Linux x86_64.
- Escape codes can be seen in your paste. What platform is that? Did you redirect output at any point?
That was copy+pasted directly out of the Godot console at the bottom.
- Was this export attempt headless or from the editor?
Straight from the editor.
- From which platform to which platform did you try exporting?
From Linux to Linux.
- I wonder where the full traceback is, the
godot
module should be embedded in the extension shared object, so I wonder at what point it fails at.
Referring to the runtime error? This is all I get from it:
$ ./test/GDExtension\ Test\ Project.x86_64
Python path configuration:
PYTHONHOME = './bin/linux-x86_64/lib/linux-x86_64'
PYTHONPATH = (not set)
program name = './test/GDExtension Test Project.x86_64'
isolated = 1
environment = 0
user site = 0
safe_path = 1
import site = 1
is in build tree = 0
stdlib dir = ''
sys._base_executable = '/home/james/Workspace/godot-python-extension/test/GDExtension Test Project.x86_64'
sys.base_prefix = './bin/linux-x86_64/lib/linux-x86_64'
sys.base_exec_prefix = './bin/linux-x86_64/lib/linux-x86_64'
sys.platlibdir = 'lib'
sys.executable = '/home/james/Workspace/godot-python-extension/test/GDExtension Test Project.x86_64'
sys.prefix = './bin/linux-x86_64/lib/linux-x86_64'
sys.exec_prefix = './bin/linux-x86_64/lib/linux-x86_64'
sys.path = [
'./bin/linux-x86_64/lib/linux-x86_64/python312.zip',
'./bin/linux-x86_64/lib/linux-x86_64/python3.12',
'./bin/linux-x86_64/lib/linux-x86_64/python3.12/lib-dynload',
'./bin/linux-x86_64/lib/linux-x86_64/python3.12/site-packages',
]
terminate called after throwing an instance of 'pybind11::error_already_set'
what(): ModuleNotFoundError: No module named 'godot'
Aborted
I'm just exporting with the default settings. I tried exporting a debug build but the error output was the same.
Possible explanation: https://github.com/godotengine/godot/pull/94373
Pushed a few fixes (some temporary) that should hopefully fix this. Tested here, but would help if you could also test and let me know if its working.
I just compiled and exported via GUI (Godot 4.2.2 stable) and got the same error.
terminate called after throwing an instance of 'pybind11::error_already_set'
what(): ModuleNotFoundError: No module named 'godot'
Aborted
Any special settings or processes I should use to export?
No, nothing special...
I'm not sure what state Godot 4.2.2 specifically is at with respect to the linked issues (and can't check right now), it's possible that the temporary fixes I put in place will be ineffective.
I'll need to add more checks and better error reporting for this.
If you feel like investigating, you could try debug printing the library_path
and related in src/extension/extension.cpp
and see if they are real and correct paths. Unfortunately, I can't think of a way to truly fix this if the issue isn't patched in that version of Godot.
This bit here is also worth looking into, and might be fixable extension side if it needs correcting: https://github.com/maiself/godot-python-extension/blob/031908e344f76c18a20e5b20b0d12bc944e29dab/lib/godot/_python_extension/editor/export_plugin.py#L66-L67
I checked Godot 4.2.2 and it should be fine. Not sure whats happening here. I'm not able to reproduce.
Ah, an idea! Did you export directly into the project folder? I suspect that that wont work, try exporting to a directory outside of the project.
Ah, an idea! Did you export directly into the project folder? I suspect that that wont work, try exporting to a directory outside of the project.
I sure did!. I just exported to a separate directory and it created three files (one x86_64 and two .so) and it ran correctly. Thank you for the tip. Looks like all exporting issues have been resolved.
Trying to export the test project fails with: