f = open(lock,'w+')
         f.close()
     except:
         pass #even if lock file cannot be created proceed with the rest of the code
 log = None
 url = None
 maxlinks = None
 cmdlength = len(sys.argv)
 if cmdlength < 2 :
     print("Please enter url to crawl and the maximum number of links to be extracted which is an optional one")
     print("Eg 1: python Main.py http://python.org 50")
     print("Eg 2: python Main.py http://python.org")
     sys.exit()
 elif cmdlength == 2 or cmdlength == 3:
     url = str(sys.argv[1])
     if not URLValidator.isValidURL(url):
         print("Either your url is not valid or a format that cannot be crawled")
         sys.exit()
     if cmdlength == 3:
         try:
             maxlinks = int(sys.argv[2])
         except ValueError:
             print('Invalid maximum links')
             sys.exit()
         if maxlinks < 1:
             print("maximum links should be minimum 1")
             sys.exit()
 else:
     print("Invalid number of arguments")
     sys.exit()
 try: