Skip to content

Commit

Permalink
fix: #28, use sys.base_prefix to find python executable instead of sy…
Browse files Browse the repository at this point in the history
…s.prefix
  • Loading branch information
wu-vincent committed Jul 29, 2024
1 parent 350eaae commit 1828ad8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions python/src/endstone/_internal/plugin_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@

def find_python():
if sys.platform == "win32":
path = os.path.join(sys.prefix, "python.exe")
path = os.path.join(sys.base_prefix, "python.exe")
else:
path = os.path.join(sys.prefix, "bin", "python")
path = os.path.join(sys.base_prefix, "bin", "python")

if os.path.isfile(path):
return path

raise RuntimeError("Unable to find Python executable")
raise RuntimeError(f"Unable to find Python executable: {path}")


class PythonPluginLoader(PluginLoader):
Expand Down
4 changes: 2 additions & 2 deletions src/endstone_runtime/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ ENDSTONE_RUNTIME_CTOR int main()
import os
import sys
if sys.platform == "win32":
sys.executable = os.path.join(sys.prefix, "python.exe")
sys.executable = os.path.join(sys.base_prefix, "python.exe")
else:
sys.executable = os.path.join(sys.prefix, "bin", "python")
sys.executable = os.path.join(sys.base_prefix, "bin", "python")
)");
py::gil_scoped_release release{};
release.disarm();
Expand Down

0 comments on commit 1828ad8

Please sign in to comment.