What is the reason for the error
TypeError: object of type 'bool' has no len()
Should i import something in my python program? I am using len(sys.argv) in if condition to check for the number of command line arguments, which are float values(like 1.2 and 2.4, etc). Any thoughts? This is in python2.6. This is how i am running the program
python BeaconsAnalysis.py 2.0 3.0
And some portion of my code where i am checking this is,
with open("luawrite", "r") as f:
if(len(sys.argv == 2)):
for line in f:
t1 = sys.argv[1]
t2 = sys.argv[2]
hashes = line.split()
t = hashes[0]
...........(goes on)
You got the parens in the wrong place and need to account for the script name in argv[0]. if(len(sys.argv == 2)):
should be if(len(sys.argv) == 3):
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With