File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -799,27 +799,29 @@ get_python_executable() ->
799799import sys, os
800800# When embedded, sys.executable points to the embedding app
801801# Use sys.prefix to find the actual Python installation
802+ _py_exe = 'python3' # default fallback
802803if sys.platform == 'win32':
803- python = os.path.join(sys.prefix, 'python.exe')
804+ path = os.path.join(sys.prefix, 'python.exe')
805+ if os.path.isfile(path):
806+ _py_exe = path
804807else:
805808 ver = f'python{sys.version_info.major}.{sys.version_info.minor}'
806809 # Try common locations
807810 for path in [
808811 os.path.join(sys.prefix, 'bin', ver),
809812 os.path.join(sys.prefix, 'bin', 'python3'),
810813 os.path.join(sys.prefix, 'bin', 'python'),
811- sys.executable # fallback
812814 ]:
813- if os.path.isfile(path) and os.access(path, os.X_OK) :
814- python = path
815- break
816- else:
817- python = 'python3'
818- python
815+ try :
816+ if os.path.isfile(path) and os.access( path, os.X_OK):
817+ _py_exe = path
818+ break
819+ except:
820+ pass
819821" >>,
820822 case exec (Code ) of
821823 ok ->
822- case eval (<<" python " >>) of
824+ case eval (<<" _py_exe " >>) of
823825 {ok , Path } when is_binary (Path ) -> binary_to_list (Path );
824826 _ -> " python3"
825827 end ;
Original file line number Diff line number Diff line change @@ -64,17 +64,19 @@ init_per_group(_Group, Config) ->
6464 % % Note: sys.executable returns beam.smp when embedded, so we find the actual Python
6565 Code = <<"
6666import sys, os
67+ _python_path = 'python3' # default
6768ver = f'python{sys.version_info.major}.{sys.version_info.minor}'
6869for path in [
6970 os.path.join(sys.prefix, 'bin', ver),
7071 os.path.join(sys.prefix, 'bin', 'python3'),
7172 os.path.join(sys.prefix, 'bin', 'python'),
7273]:
73- if os.path.isfile(path) and os.access(path, os.X_OK):
74- _python_path = path
75- break
76- else:
77- _python_path = 'python3'
74+ try:
75+ if os.path.isfile(path) and os.access(path, os.X_OK):
76+ _python_path = path
77+ break
78+ except:
79+ pass
7880" >>,
7981 ok = py :exec (Code ),
8082 {ok , PythonPath } = py :eval (<<" _python_path" >>),
You can’t perform that action at this time.
0 commit comments