Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changes/dev/13593.other.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
make :func:`mne.sys_info` work on Windows systems with Powershell version 7+, by `Marijn van Vliet`_
9 changes: 4 additions & 5 deletions mne/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,11 +681,9 @@ def _get_gpu_info():
def _get_total_memory():
"""Return the total memory of the system in bytes."""
if platform.system() == "Windows":
ps = shutil.which("pwsh") or shutil.which("powershell")
o = subprocess.check_output(
[
"powershell.exe",
"(Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory",
]
[ps, "-c", "(Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory"]
).decode()
# Can get for example a "running scripts is disabled on this system"
# error where "o" will be a long string rather than an int
Expand All @@ -708,8 +706,9 @@ def _get_total_memory():
def _get_cpu_brand():
"""Return the CPU brand string."""
if platform.system() == "Windows":
ps = shutil.which("pwsh") or shutil.which("powershell")
o = subprocess.check_output(
["powershell.exe", "(Get-CimInstance Win32_Processor).Name"]
[ps, "-c", "(Get-CimInstance Win32_Processor).Name"]
).decode()
cpu_brand = o.strip().splitlines()[-1]
elif platform.system() == "Linux":
Expand Down
Loading