File tree Expand file tree Collapse file tree 3 files changed +12
-22
lines changed
Expand file tree Collapse file tree 3 files changed +12
-22
lines changed Original file line number Diff line number Diff line change @@ -898,8 +898,6 @@ void InitBasicEventListeners() {
898898 });
899899
900900 // 植入tick
901- using namespace ll ::chrono_literals;
902-
903901 ll::coro::keepThis ([]() -> ll::coro::CoroTask<> {
904902 using namespace ll ::chrono_literals;
905903
Original file line number Diff line number Diff line change @@ -40,12 +40,18 @@ bool pythonInited = false;
4040bool initPythonRuntime () {
4141 if (!pythonInited) {
4242 script::py_interop::setPythonHomePath (lse::getSelfPluginInstance ().getModDir ());
43- script::py_interop::setModuleSearchPaths ({
44- lse::getSelfPluginInstance ().getModDir () / " python310.zip" ,
45- lse::getSelfPluginInstance ().getModDir () / " DLLs" ,
46- lse::getSelfPluginInstance ().getModDir () / " Lib" ,
47- lse::getSelfPluginInstance ().getModDir () / " site-packages" ,
48- });
43+ const char * pathEnv = std::getenv (" PATH" );
44+ auto paths = ll::string_utils::splitByPattern (pathEnv, " ;" );
45+ std::vector<std::wstring> modulePaths;
46+ for (const auto & p : paths) {
47+ if (p.find (" Python" ) != std::string::npos) {
48+ std::wstring wstr = ll::string_utils::str2wstr (p);
49+ modulePaths.push_back (wstr + L" \\ DLLs" );
50+ modulePaths.push_back (wstr + L" \\ Lib" );
51+ modulePaths.push_back (wstr + L" \\ site-packages" );
52+ }
53+ }
54+ script::py_interop::setModuleSearchPaths (modulePaths);
4955 pythonInited = true ;
5056 }
5157 return true ;
Original file line number Diff line number Diff line change @@ -21,20 +21,6 @@ bool processPythonDebugEngine(const std::string& cmd);
2121bool processConsolePipCmd (const std::string& cmd);
2222int executePipCommand (std::string cmd);
2323
24- // This fix is used for Python3.10's bug:
25- // The thread will freeze when creating a new engine while another thread is
26- // blocking to read stdin Side effects: sys.stdin cannot be used after this
27- // patch. More info to see: https://github.com/python/cpython/issues/83526
28- //
29- // Attention! When CPython is upgraded, this fix must be re-adapted or removed!!
30- //
31- namespace FixPython310Stdin {
32-
33- bool patchPython310CreateStdio ();
34- bool unpatchPython310CreateStdio ();
35-
36- } // namespace FixPython310Stdin
37-
3824} // namespace PythonHelper
3925
4026#endif
You can’t perform that action at this time.
0 commit comments