Skip to content

Commit

Permalink
suppress an expected error
Browse files Browse the repository at this point in the history
  • Loading branch information
th3w1zard1 committed Feb 24, 2024
1 parent ba1bd70 commit 6cf374d
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions install_python_venv.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -306,14 +306,17 @@ function Get-Python-Version {
Param (
[string]$pythonPath
)
if (Test-Path $pythonPath -ErrorAction SilentlyContinue) {
$global:pythonVersionOutput = & $pythonPath --version 2>&1
$global:pythonVersionString = $global:pythonVersionOutput -replace '^Python\s+'
$numericVersionString = $global:pythonVersionString -replace '(\d+\.\d+\.\d+).*', '$1'
$global:pythonVersion = [Version]$numericVersionString
return $global:pythonVersion
try {
if (Test-Path $pythonPath -ErrorAction SilentlyContinue) {
$global:pythonVersionOutput = & $pythonPath --version 2>&1
$global:pythonVersionString = $global:pythonVersionOutput -replace '^Python\s+'
$numericVersionString = $global:pythonVersionString -replace '(\d+\.\d+\.\d+).*', '$1'
$global:pythonVersion = [Version]$numericVersionString
return $global:pythonVersion
}
} catch {
return [Version]"0.0.0"
}
return [Version]"0.0.0"
}

$minVersion = [Version]"3.8.0"
Expand Down

0 comments on commit 6cf374d

Please sign in to comment.