twint icon indicating copy to clipboard operation
twint copied to clipboard

version check has a bug

Open dmhowcroft opened this issue 3 years ago • 2 comments

https://github.com/twintproject/twint/blob/e7c8a0c764f6879188e5c21e25fb6f1f856a7221/twint/cli.py#L335

twint raises an error that "TWINT requires Python version 3.6+" when you try to run it in Python 3.10 because the comparison casts the version as a float.

It would be better to take the version number as a tuple and compare it works with semantic versioning.

>>> (3, 10) > (3, 6)
True

dmhowcroft avatar Dec 18 '21 12:12 dmhowcroft

I do this little change like you suggest @dmhowcroft and it seems to work:

--- cli.py.bkp	2022-01-15 10:23:22.172975710 +0100
+++ cli.py	2022-01-15 10:35:20.349681221 +0100
@@ -297,8 +297,7 @@ def main():
         run.Search(c)
 
 def run_as_command():
-    version = ".".join(str(v) for v in sys.version_info[:2])
-    if float(version) < 3.6:
+    if (sys.version_info.major, sys.version_info.minor) < (3, 6):
         print("[-] TWINT requires Python version 3.6+.")
         sys.exit(0)

homer242 avatar Jan 15 '22 09:01 homer242

I do this little change like you suggest @dmhowcroft and it seems to work:

--- cli.py.bkp	2022-01-15 10:23:22.172975710 +0100
+++ cli.py	2022-01-15 10:35:20.349681221 +0100
@@ -297,8 +297,7 @@ def main():
         run.Search(c)
 
 def run_as_command():
-    version = ".".join(str(v) for v in sys.version_info[:2])
-    if float(version) < 3.6:
+    if (sys.version_info.major, sys.version_info.minor) < (3, 6):
         print("[-] TWINT requires Python version 3.6+.")
         sys.exit(0)

This one works for me.

Florettt avatar Feb 12 '22 10:02 Florettt