You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Below code snippet is working fine with the packaging version 21.3 , but throwing an error "Invalid version" on latest version (24.0 & 24.1)
test.py
import` os,sys,subprocess
from decimal import Decimal
from packaging import version
str1='8.9p1-8'
str2='8.9p1-6'
if version.parse(str1) > version.parse(str2):
print("OK")
executing on version 24.0 & 24.1 :
#python3 test.py
Traceback (most recent call last):
File "/root/test.py", line 9, in <module>
if version.parse(str1) > version.parse(str2):
^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/packaging/version.py", line 56, in parse
return Version(version)
^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/packaging/version.py", line 202, in __init__
raise InvalidVersion(f"Invalid version: '{version}'")
packaging.version.InvalidVersion: Invalid version: '8.9p1-8'
executing on version 21.3:
#python3 test.py
OK
The text was updated successfully, but these errors were encountered:
HarinadhD
changed the title
Exception during version parsing
version.parse : exception during version parsing
Jul 4, 2024
Below code snippet is working fine with the packaging version 21.3 , but throwing an error "Invalid version" on latest version (24.0 & 24.1)
test.py
executing on version 24.0 & 24.1 :
executing on version 21.3:
#python3 test.py
OK
The text was updated successfully, but these errors were encountered: