Skip to content
This repository has been archived by the owner on Mar 30, 2023. It is now read-only.

version check has a bug #1313

Open
dmhowcroft opened this issue Dec 18, 2021 · 2 comments
Open

version check has a bug #1313

dmhowcroft opened this issue Dec 18, 2021 · 2 comments

Comments

@dmhowcroft
Copy link

if float(version) < 3.6:

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
@homer242
Copy link

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)

@Florettt
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants