Skip to content

Commit 00c1b4b

Browse files
committed
python_version: pass out optional debug message
1 parent 18dff9d commit 00c1b4b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

+stdlib/python_version.m

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@
1212
% where the environment has changed since pyenv() was set. For example
1313
% HPC with "module load python3..."
1414

15-
function v = python_version(force_old)
15+
function [v, msg] = python_version(force_old)
1616
if nargin < 1
1717
force_old = false;
1818
end
1919

2020
persistent stdlib_py_version
2121

22+
msg = '';
23+
2224
if ~isempty(stdlib_py_version)
2325
v = stdlib_py_version;
2426
return
@@ -34,9 +36,11 @@
3436
return
3537
end
3638

37-
% need to have no catch section as glitchy Python load can make TypeError etc.
38-
try %#ok<TRYNC>
39+
% glitchy Python load can error on sys.version_info
40+
try
3941
v = pvt_python_version();
42+
catch e
43+
msg = e.message;
4044
end
4145

4246
% cache the result

0 commit comments

Comments
 (0)