Help with regular expressions

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dbphydb
    New Member
    • Apr 2010
    • 22

    Help with regular expressions

    I am trying to search for a text 'BUILD COMPLETE' on a web page. There is some problem with the RE. Please help. I am new to Python and somehow managed to reach to this point of the program.

    Code:
    URL = "http://10.47.42.27:8080/cruisecontrol"
    
    from urllib2 import urlopen
    from HTMLParser import HTMLParser
    
    import re
    
    # Fetching links using HTMLParser
    def get_links(url):
        parser = MyHTMLParser()
        parser.feed(urlopen(url).read())
        parser.close()
        return parser.links
    
    #
    def build_check(url):
        parser = DataParser()
        parser.feed(urlopen(url).read())
        parser.close()
        return parser.data
    
    # Build url for Deploy page
    def get_deploy_url():
        url = URL + "/buildresults/Poker-TTM_%s_nightly_build" % branch
        print url
        #for parser.data in build_check(url):
        parser = DataParser()
        parser.feed(urlopen(url).read())
        parser.close()
        parser.data
        [B]build_re = re.compile(r"BUILD COMPLETE")
        print "before if"
        if build_re.search(parser.data):[/B]
            print "after if"
            for link in get_links(url):
                if link["href"].startswith("Deploy"):
                    return "%s/%s" % (URL, link["href"])
        else:
            print "Build Failed"
    
    # Build url for Destination page
    def get_destination_url():
        url = get_deploy_url()
    
    # Parsing HTML pages 
    class MyHTMLParser(HTMLParser):
        def __init__(self, *args, **kwd):
            HTMLParser.__init__(self, *args, **kwd)
            self.links = []
    
        def handle_starttag(self, tag, attrs):
            if tag == "a":
                attrs = dict(attrs)
                if "href" in attrs:
                    self.links.append(dict(attrs))
    
        def handle_endtag(self, tag):
            pass
    
    # To find all text in the HTML table
    class DataParser(HTMLParser):
        def handle_data(self, data):
            self.data = data.strip()
            if data:
                print self.data
            
    if __name__ == "__main__":
        # Read the branch name and the test destination to deploy on
        lines = [x.split(':') for x in open("branch_dest.txt")]
        print lines
        branch = "%s" % lines[0][1].strip()
        print branch
        destination = "%s" % lines[1][1].strip()
        print destination
        
        final_url = get_destination_url()
    I am getting Build Failed output even when the webpage has BUILD COMPLETE and DataParser is returning this.
  • Glenton
    Recognized Expert Contributor
    • Nov 2008
    • 391

    #2
    I'm not sure why that would search the data for BUILD COMPLETE. Maybe if you had ".*BUILD COMPLETE.*". But the search will also return a match object rather than a TRUE or FALSE.

    Try the docs, and if you don't have any luck post back.

    Comment

    • dbphydb
      New Member
      • Apr 2010
      • 22

      #3
      Hi Glenton,
      I tried but it stills gives me output as Build Failed even though the data variable prints outs BUILD COMPLETE.

      Code:
      [['Branch', ' trunk\n'], ['Destination', ' Test 4\n']]
      trunk
      Test 4
      http://10.47.42.27:8080/cruisecontrol/buildresults/Poker-TTM_trunk_nightly_build
      
      
      CruiseControl Build Results
      Project
      -- STATUS PAGE --
      BScreened_trunk
      
      Poker-TTM_7.1.0_nightly_build
      
      Poker-TTM_7.2.0_nightly_build
      
      Poker-TTM_7.2.1_nightly_build
      
      Poker-TTM_7.3.0_nightly_build
      
      Poker-TTM_7.3.1_nightly_build
      
      Poker-TTM_7.3.2_nightly_build
      
      Poker-TTM_Wrk7.5.0_nightly_build
      
      Poker-TTM_cpn_nightly_build
      
      Poker-TTM_filemap_nightly_build
      
      Poker-TTM_fl_lc_7.4_nightly_build
      
      Poker-TTM_gms_7.4_nightly_build
      
      Poker-TTM_ltm_7.4_nightly_build
      
      Poker-TTM_orders_nightly_build
      
      Poker-TTM_sa_7.4_nightly_build
      
      Poker-TTM_sa_ft0_nightly_build
      
      Poker-TTM_sa_ft1_nightly_build
      
      Poker-TTM_sa_ft4_nightly_build
      
      Poker-TTM_sa_itf_new_nightly_build
      
      Poker-TTM_sigma_me_nightly_build
      
      Poker-TTM_splash_nightly_build
      
      Poker-TTM_svs7.4.1_nightly_build
      
      Poker-TTM_svs_7.4_nightly_build
      
      Poker-TTM_trunk_nightly_build
      
      count_lines
      
      cruisecontrol_janitor
      
      
      
      
      
      waiting for next time to build since
      05/14/2010 00:33:43
      progress: 00:33:43 next build in 22 hours 27 minutes
      
      
      Latest Build
      
      2010/05/13 23:04:47 (27482)
      
      2010/05/12 23:04:43 (27478)
      
      ............
      ............
      
      More builds
      
      2010/05/03 23:04:23 (27272)
      
      2010/04/30 23:04:46 (27251)
      
      ............
      ............
      
      Build Results
      Unit Test Results
      Auto Test Results
      XML Log File
      Metrics
      Control Panel
      
      
      
      
      
      BUILD COMPLETE
      -
      27482
      
      
      
      Date of build:
      
      05/13/2010 23:04:47
      
      
      
      Time to build:
      
      85 minutes 24 seconds
      
      
      
      Last changed:
      
      05/13/2010 18:16:26
      
      ............
      ............
      I am actually a tester and have somehow managed to reach to this point. Please help.

      Comment

      • Glenton
        Recognized Expert Contributor
        • Nov 2008
        • 391

        #4
        So thinking about it, much though I love regular expressions, I think it's easier to use the 'in' keyword.

        Code:
        In [7]: test1="blah blah BUILD COMPLETE blah"
        
        In [8]: test2="blah blah blah"
        
        In [9]: "BUILD COMPLETE" in test1
        Out[9]: True
        
        In [10]: "BUILD COMPLETE" in test2
        Out[10]: False

        Comment

        • dbphydb
          New Member
          • Apr 2010
          • 22

          #5
          Hi,
          I tried using that too
          Code:
          URL = "http://10.47.42.27:8080/cruisecontrol"
          
          from urllib2 import urlopen
          from HTMLParser import HTMLParser
          
          import re
          
          # Fetching links using HTMLParser
          def get_links(url):
              parser = MyHTMLParser()
              parser.feed(urlopen(url).read())
              parser.close()
              return parser.links
          
          #
          def build_check(url):
              parser = DataParser()
              parser.feed(urlopen(url).read())
              parser.close()
              return parser.data
          
          # Build url for Deploy page
          def get_deploy_url():
              url = URL + "/buildresults/Poker-TTM_%s_nightly_build" % branch
              print url
              parser = DataParser()
              parser.feed(urlopen(url).read())
              parser.close()
              print "before if"
              [B]if parser.found:  [B][I]# It doesnt seem to get inside this if[/I][/B]
                  print "BUILD COMPLETE"[/B]
                  for link in get_links(url):
                      if link["href"].startswith("Deploy"):
                          return "%s/%s" % (URL, link["href"])
              print url
              #else:
              #    print "Build Failed"
          
          ### Build url for Destination page 
          ##def get_destination_url():
          ##    url = get_deploy_url()
          ##    #print "URL is %s" % url
          ##    #destination_re = re.compile(r"%s" % destination)
          ##    #for link in get_links(url):
          ##    #    if destination_re.search(link["href"]):
          ##    #        return "http://10.47.42.27:8080/cruisecontrol/" + link["href"]
          
          # Parsing HTML pages 
          class MyHTMLParser(HTMLParser):
              def __init__(self, *args, **kwd):
                  HTMLParser.__init__(self, *args, **kwd)
                  self.links = []
          
              def handle_starttag(self, tag, attrs):
                  if tag == "a":
                      attrs = dict(attrs)
                      if "href" in attrs:
                          self.links.append(dict(attrs))
          
              def handle_endtag(self, tag):
                  pass
          
          # To find all text in the HTML table
          [B]class DataParser(HTMLParser):
              def handle_data(self, data):
                  self.find = "COMPLETE"
                  self.found = False
                  self.data = data.strip()
                  if self.data and (self.find in self.data):
                      self.found = True
                      print "FOUND"[/B]  [B][I]#This is getting printed[/I][/B]
                  
          if __name__ == "__main__":
              # Read the branch name and the test destination to deploy on
              lines = [x.split(':') for x in open("branch_dest.txt")]
              print lines
              branch = "%s" % lines[0][1].strip()
              print branch
              destination = "%s" % lines[1][1].strip()
              print destination
              
              final_url = get_deploy_url()
              if final_url is None:
                  print "Could not find a destination to deploy"
              else:
                  print final_url

          Comment

          • Glenton
            Recognized Expert Contributor
            • Nov 2008
            • 391

            #6
            Please insert a print of the various variables involved in the if statement, and also a print of the type(variable_n ame) just before the if statement, and post back the result.

            Comment

            • dbphydb
              New Member
              • Apr 2010
              • 22

              #7
              Hi,
              Below is the code
              Code:
              URL = "http://10.47.42.27:8080/cruisecontrol"
              
              from urllib2 import urlopen
              from HTMLParser import HTMLParser
              
              import re
              
              # Fetching links using HTMLParser
              def get_links(url):
                  parser = MyHTMLParser()
                  parser.feed(urlopen(url).read())
                  parser.close()
                  return parser.links
              
              #
              #def build_check(url):
              #    parser = DataParser()
              #    parser.feed(urlopen(url).read())
              #    parser.close()
              #    return parser.data
              
              # Build url for Deploy page
              def get_deploy_url():
                  url = URL + "/buildresults/Poker-TTM_%s_nightly_build" % branch
                  print "Latest build url for this branch is: %s" % url
                  
                  parser = DataParser()
                  parser.feed(urlopen(url).read())
                  parser.close()
                  parser.data
                  
                  print "Test for control before IF"
                  if parser.data:
                      print "Data in parser exists"
                      if "BUILD COMPLETE" in parser.data:
                          print "BUILD COMPLETE found"
                          for link in get_links(url):
                              if link["href"].startswith("Deploy"):
                                  return "%s/%s" % (URL, link["href"])
                  else:
                      print "Build Failed"
              
              # Build url for Destination page
              def get_destination_url():
                  url = get_deploy_url()
                  print "Deploy page url is: %s" % url
                  #destination_re = re.compile(r"%s" % destination)
                  #for link in get_links(url):
                  #    if destination_re.search(link["href"]):
                  #        return "http://10.47.42.27:8080/cruisecontrol/" + link["href"]
              
              # Parsing HTML pages 
              class MyHTMLParser(HTMLParser):
                  def __init__(self, *args, **kwd):
                      HTMLParser.__init__(self, *args, **kwd)
                      self.links = []
              
                  def handle_starttag(self, tag, attrs):
                      if tag == "a":
                          attrs = dict(attrs)
                          if "href" in attrs:
                              self.links.append(dict(attrs))
              
                  def handle_endtag(self, tag):
                      pass
              
              # To find all text in the HTML table
              class DataParser(HTMLParser):
                  def handle_data(self, data):
                      self.data = data.strip()
                      if data:
                          print self.data
                      
              if __name__ == "__main__":
                  # Read the branch name and the test destination to deploy on
                  lines = [x.split(':') for x in open("branch_dest.txt")]
                  print lines
                  branch = "%s" % lines[0][1].strip()
                  print "Branch Name: %s" % branch
                  destination = "%s" % lines[1][1].strip()
                  print "Test Destination: %s" % destination
                  
                  final_url = get_destination_url()
                  #if final_url is None:
                  #    print "Could not find a destination to deploy"
                  #else:
                  #    print final_url
              Below is the output
              Code:
              >>> 
              [['Branch', ' trunk\n'], ['Destination', ' Test 4\n']]
              Branch Name: trunk
              Test Destination: Test 4
              Latest build url for this branch is: http://10.47.42.27:8080/cruisecontrol/buildresults/Poker-TTM_trunk_nightly_build
              
              
              
              CruiseControl Build Results
              
              
              
              
              
              
              
              
              
              
              
              
              Project
              
              
              
              
              -- STATUS PAGE --
              
              BScreened_trunk
              
              Poker-TTM_7.1.0_nightly_build
              
              Poker-TTM_7.2.0_nightly_build
              
              Poker-TTM_7.2.1_nightly_build
              
              Poker-TTM_7.3.0_nightly_build
              
              Poker-TTM_7.3.1_nightly_build
              
              Poker-TTM_7.3.2_nightly_build
              
              Poker-TTM_Wrk7.5.0_nightly_build
              
              Poker-TTM_cpn_nightly_build
              
              Poker-TTM_filemap_nightly_build
              
              Poker-TTM_fl_lc_7.4_nightly_build
              
              Poker-TTM_gms_7.4_nightly_build
              
              Poker-TTM_ltm_7.4_nightly_build
              
              Poker-TTM_orders_nightly_build
              
              Poker-TTM_sa_7.4_nightly_build
              
              Poker-TTM_sa_ft0_nightly_build
              
              Poker-TTM_sa_ft1_nightly_build
              
              Poker-TTM_sa_ft4_nightly_build
              
              Poker-TTM_sa_itf_new_nightly_build
              
              Poker-TTM_sigma_me_nightly_build
              
              Poker-TTM_splash_nightly_build
              
              Poker-TTM_svs7.4.1_nightly_build
              
              Poker-TTM_svs_7.4_nightly_build
              
              Poker-TTM_trunk_nightly_build
              
              count_lines
              
              cruisecontrol_janitor
              
              
              
              
              
              waiting for next time to build since
              05/14/2010 00:33:43
              progress: 00:33:43 next build in 22 hours 27 minutes
              
              
              Latest Build
              
              2010/05/13 23:04:47 (27482)
              
              2010/05/12 23:04:43 (27478)
              
              2010/05/11 23:04:52 (27455)
              
              2010/05/10 17:41:50 (27412)
              
              2010/05/08 23:03:41 (27400)
              
              2010/05/07 23:04:31 (27399)
              
              2010/05/06 23:04:32 (27369)
              
              2010/05/05 23:04:13 (27340)
              
              2010/05/04 23:04:48 (27305)
              
              2010/05/04 15:36:31 (27299)
              
              
              
              
              More builds
              
              2010/05/03 23:04:23 (27272)
              
              2010/04/30 23:04:46 (27251)
              
              2010/04/29 23:04:46 (27220)
              
              2010/04/29 12:36:44 (27199)
              
              2010/04/28 23:04:28
              
              2010/04/27 23:04:30 (27139)
              
              2010/04/26 23:04:11 (27108)
              
              2010/04/26 16:03:53 (27098)
              
              2010/04/23 23:04:46 (27083)
              
              2010/04/22 23:04:33 (27043)
              
              2010/04/21 23:04:51 (26998)
              
              2010/04/21 08:31:08 (26966)
              
              2010/04/20 23:04:40
              
              2010/04/20 13:10:59
              
              2010/04/20 13:05:30
              
              2010/04/20 10:29:09
              
              2010/04/19 23:04:08 (26930)
              
              2010/04/19 12:27:42
              
              2010/04/16 23:04:24 (26902)
              
              2010/04/16 11:28:40 (26877)
              
              2010/04/15 23:04:42 (26873)
              
              2010/04/15 10:52:50 (26855)
              
              2010/04/14 23:04:32 (26850)
              
              2010/04/14 09:41:56
              
              2010/04/13 23:04:48
              
              2010/04/12 23:04:44 (26772)
              
              2010/04/12 10:11:36
              
              2010/04/11 23:04:12
              
              2010/04/10 23:03:48
              
              2010/04/10 17:29:50
              
              2010/04/09 23:04:35
              
              2010/04/08 23:04:45 (26693)
              
              2010/04/08 07:50:58
              
              2010/04/07 23:04:31
              
              2010/04/07 15:33:12 (26655)
              
              2010/04/07 10:48:51
              
              2010/04/06 18:49:16 (26624)
              
              2010/04/06 09:19:55 (26600)
              
              2010/04/05 23:03:34
              
              2010/04/01 23:04:16
              
              2010/03/31 23:05:12
              
              2010/03/31 05:48:28 (26564.1)
              
              2010/03/30 23:04:40
              
              2010/03/29 23:04:03 (26529)
              
              2010/03/26 23:04:32 (26507)
              
              2010/03/25 23:05:31
              
              2010/03/24 23:05:40 (26458)
              
              2010/03/24 08:00:19
              
              2010/03/23 23:05:15 (26428)
              
              2010/03/22 23:05:43 (26394)
              
              2010/03/19 23:05:15 (26362)
              
              2010/03/18 23:05:28 (26333)
              
              2010/03/17 23:04:55 (26296)
              
              2010/03/16 23:05:39 (26269)
              
              2010/03/16 15:01:15 (26259)
              
              2010/03/16 13:07:48
              
              2010/03/15 23:05:32 (26242)
              
              2010/03/12 23:05:36 (26226)
              
              2010/03/11 23:04:59 (26205)
              
              2010/03/10 23:05:00 (26185)
              
              2010/03/09 23:05:32 (26160)
              
              2010/03/08 23:05:25 (26139)
              
              2010/03/05 23:05:24 (26120)
              
              2010/03/04 23:04:58 (26084)
              
              2010/03/03 23:04:24 (26063)
              
              2010/03/02 23:05:39 (26038)
              
              2010/03/01 23:06:14 (26015)
              
              2010/02/26 23:05:36 (25988)
              
              2010/02/25 23:05:15 (25956)
              
              2010/02/24 23:06:05 (25934)
              
              2010/02/24 15:10:03
              
              2010/02/24 13:42:59
              
              2010/02/23 23:04:51
              
              2010/02/23 10:52:39 (25864)
              
              2010/02/23 09:33:27
              
              2010/02/22 23:04:16
              
              2010/02/21 16:14:42 (25828.1)
              
              2010/02/21 14:24:17 (25828)
              
              2010/02/19 23:04:19 (25817)
              
              2010/02/18 23:04:18 (25778)
              
              2010/02/18 13:44:46 (25758)
              
              2010/02/17 23:05:14 (25748)
              
              2010/02/16 23:04:55 (25725)
              
              2010/02/15 23:04:55 (25689)
              
              2010/02/12 23:06:36 (25655)
              
              2010/02/12 13:49:47 (25641)
              
              2010/02/11 23:05:28 (25622)
              
              2010/02/10 16:27:54 (25586)
              
              2010/02/09 16:10:35 (25538)
              
              2010/02/08 23:05:35
              
              2010/02/05 17:12:15 (25473)
              
              2010/02/05 15:08:14
              
              2010/02/04 23:05:19 (25433)
              
              2010/02/04 08:59:12 (25390)
              
              2010/02/03 23:04:51 (25389)
              
              2010/02/03 10:40:11
              
              2010/02/03 10:04:43
              
              2010/02/02 23:05:32 (25358)
              
              2010/02/01 23:05:20 (25331)
              
              2010/01/29 23:05:02 (25301)
              
              2010/01/28 23:05:13 (25263)
              
              2010/01/27 23:05:24 (25232)
              
              2010/01/27 12:01:24 (25198)
              
              2010/01/26 23:06:00
              
              2010/01/25 23:06:22 (25140)
              
              2010/01/22 23:05:20 (25105)
              
              2010/01/21 23:04:21 (25078)
              
              2010/01/21 13:42:39 (25069)
              
              2010/01/20 23:05:59 (25052)
              
              2010/01/19 23:06:45 (25011)
              
              2010/01/19 08:24:58 (24948)
              
              2010/01/18 23:02:42
              
              2010/01/18 17:46:36
              
              2010/01/16 23:03:43 (24900)
              
              2010/01/16 12:43:48
              
              2010/01/15 23:05:01
              
              2010/01/14 23:04:03 (24864)
              
              2010/01/13 23:05:21 (24845)
              
              2010/01/13 10:00:02 (24821)
              
              2010/01/13 07:41:50
              
              2010/01/13 06:35:01
              
              2010/01/12 23:04:42
              
              2010/01/11 23:05:38
              
              2010/01/08 23:05:33 (24694)
              
              2010/01/07 23:05:19 (24672)
              
              2010/01/06 23:03:23 (24642)
              
              2010/01/05 23:04:59 (24632)
              
              2010/01/04 23:02:23 (24619)
              
              2009/12/30 23:04:39 (24596)
              
              2009/12/29 23:05:07 (24587)
              
              2009/12/28 23:05:16 (24566)
              
              2009/12/23 23:05:22 (24554)
              
              2009/12/22 23:05:10 (24524)
              
              2009/12/21 23:05:32 (24496)
              
              2009/12/20 23:05:58
              
              2009/12/19 23:03:48
              
              2009/12/18 23:05:36
              
              2009/12/17 23:03:54 (24420)
              
              2009/12/16 23:03:45 (24406)
              
              2009/12/15 23:03:48 (24384)
              
              2009/12/14 23:04:03 (24354)
              
              2009/12/12 23:04:32 (24321)
              
              2009/12/11 23:04:21 (24320)
              
              2009/12/10 23:04:23 (24297)
              
              2009/12/08 23:05:28 (24254)
              
              2009/12/07 23:04:24 (24220)
              
              2009/12/04 23:04:17 (24200)
              
              2009/12/03 23:03:45 (24174)
              
              2009/12/02 23:04:35 (24149)
              
              2009/12/01 23:05:32 (24118)
              
              2009/12/01 10:17:55 (24097)
              
              2009/11/30 14:04:35 (24086)
              
              2009/11/30 12:37:27
              
              2009/11/26 23:04:16 (24057)
              
              2009/11/26 17:59:29 (24056)
              
              2009/11/26 16:46:56
              
              2009/11/26 13:13:12 (24038)
              
              2009/11/25 23:04:17 (24021)
              
              2009/11/25 13:11:28 (24009)
              
              2009/11/25 08:56:42 (24001.1)
              
              2009/11/24 23:04:31
              
              2009/11/24 11:30:02 (23969)
              
              2009/11/23 23:04:35 (23964)
              
              2009/11/23 09:45:32 (23949)
              
              2009/11/20 23:04:11 (23939)
              
              2009/11/19 23:04:07 (23911)
              
              2009/11/19 09:41:44 (23888)
              
              2009/11/18 23:03:49 (23880)
              
              2009/11/17 23:04:00 (23840)
              
              2009/11/16 23:04:21 (23809)
              
              2009/11/13 23:04:05 (23785)
              
              2009/11/12 23:04:10 (23749)
              
              2009/11/11 23:04:17 (23720)
              
              2009/11/10 23:03:43 (23693)
              
              2009/11/09 23:04:04 (23666)
              
              2009/11/09 10:15:47 (23649)
              
              2009/11/08 23:02:50
              
              2009/11/07 23:02:57
              
              2009/11/06 23:03:40
              
              2009/11/05 23:04:05 (23608)
              
              2009/11/04 23:04:10 (23567)
              
              2009/11/03 23:04:24 (23521)
              
              2009/11/03 13:07:18 (23494)
              
              2009/11/02 23:03:47 (23481)
              
              2009/10/30 23:03:30 (23460)
              
              2009/10/30 13:17:38 (23455)
              
              2009/10/30 09:50:00
              
              2009/10/29 23:03:45 (23451)
              
              2009/10/28 23:04:30 (23429)
              
              2009/10/27 23:03:48 (23388)
              
              2009/10/26 23:04:04 (23354)
              
              2009/10/23 23:05:04 (23319)
              
              2009/10/22 23:03:42 (23155)
              
              2009/10/22 14:21:14 (23147)
              
              2009/10/21 23:03:58 (23128)
              
              2009/10/20 23:04:26 (23107)
              
              2009/10/19 23:03:48 (23079)
              
              2009/10/16 23:03:57 (23028)
              
              2009/10/15 23:04:00 (22998)
              
              2009/10/15 12:54:04 (22977)
              
              2009/10/15 08:23:43 (22968)
              
              2009/10/14 23:04:39
              
              2009/10/14 09:16:56 (22938)
              
              2009/10/13 23:04:12
              
              2009/10/12 23:04:23 (22897)
              
              2009/10/12 14:12:11 (22888)
              
              2009/10/09 23:04:24 (22869)
              
              2009/10/08 23:04:32 (22847)
              
              2009/10/07 23:04:44 (22814)
              
              2009/10/06 23:03:51 (22763)
              
              2009/10/05 23:04:44 (22732)
              
              2009/10/04 23:03:02 (22698)
              
              2009/10/02 23:04:09 (22694)
              
              2009/10/01 23:04:07 (22662)
              
              2009/09/30 23:04:15 (22610.1)
              
              2009/09/29 23:04:59 (22610)
              
              2009/09/29 09:10:09 (22566)
              
              2009/09/28 23:04:39
              
              2009/09/28 11:32:02 (22535)
              
              2009/09/25 23:03:51 (22516)
              
              2009/09/25 11:24:52 (22489)
              
              2009/09/24 23:03:47 (22469)
              
              2009/09/24 10:04:47
              
              2009/09/23 23:03:54
              
              2009/09/23 09:34:47 (22382)
              
              2009/09/22 23:04:00
              
              2009/09/21 23:03:36 (22337)
              
              2009/09/19 23:03:56 (22309)
              
              2009/09/18 23:04:52 (22308)
              
              2009/09/17 23:03:46 (22251)
              
              2009/09/17 09:11:59 (22212)
              
              2009/09/16 23:04:13
              
              2009/09/16 12:26:29 (22180)
              
              2009/09/15 23:04:45 (22160)
              
              2009/09/14 23:02:38 (22105)
              
              2009/09/14 11:08:21 (22080)
              
              2009/09/13 23:03:09
              
              2009/09/12 23:02:45
              
              2009/09/11 23:02:46
              
              2009/09/11 17:14:11
              
              2009/09/11 14:32:19
              
              2009/09/11 11:32:57
              
              2009/09/10 23:05:10
              
              2009/09/10 05:35:29
              
              2009/09/09 23:03:55
              
              2009/09/09 08:32:44
              
              2009/09/08 23:04:08
              
              2009/09/07 23:04:15 (21890)
              
              2009/09/05 23:03:55 (21848)
              
              2009/09/04 23:03:37 (21845)
              
              2009/09/04 10:53:36 (21825)
              
              2009/09/04 09:51:31
              
              2009/09/04 08:45:35
              
              2009/09/03 23:03:31 (21809)
              
              2009/09/02 23:04:12 (21776)
              
              2009/09/01 23:04:06 (21729)
              
              2009/09/01 16:43:45 (21719)
              
              2009/09/01 15:33:34
              
              2009/08/31 23:03:42 (21690)
              
              2009/08/31 15:33:43
              
              2009/08/28 23:03:24 (21644)
              
              2009/08/28 11:27:47
              
              2009/08/27 23:04:14
              
              2009/08/26 23:03:40 (21574)
              
              2009/08/26 08:40:30
              
              2009/08/25 23:03:46
              
              2009/08/24 23:04:00 (21490)
              
              2009/08/24 09:23:48 (21471)
              
              2009/08/23 23:03:05
              
              2009/08/22 23:02:57
              
              2009/08/21 23:04:03
              
              2009/08/20 23:03:46 (21430)
              
              2009/08/19 23:03:53 (21393)
              
              2009/08/19 07:41:54 (21338)
              
              2009/08/18 23:03:19
              
              2009/08/18 15:26:33
              
              2009/08/18 12:57:11
              
              2009/08/17 23:03:34
              
              2009/08/17 16:11:16
              
              2009/08/16 23:02:27
              
              2009/08/15 23:03:07
              
              2009/08/14 23:03:05
              
              2009/08/13 23:02:35
              
              2009/08/13 18:13:19
              
              2009/08/13 10:25:59
              
              2009/08/13 07:23:05
              
              2009/08/12 23:03:22
              
              2009/08/12 16:49:29
              
              2009/08/12 13:52:03
              
              2009/08/12 11:17:24
              
              2009/08/12 07:39:18
              
              2009/08/11 23:03:25
              
              2009/08/11 14:26:14
              
              2009/08/11 11:38:47
              
              2009/08/11 11:27:27
              
              2009/08/10 23:03:04
              
              2009/08/10 13:53:47 (21087)
              
              2009/08/10 13:21:02
              
              2009/08/10 11:53:34
              
              2009/08/09 23:02:37
              
              2009/08/08 23:02:20
              
              2009/08/08 14:37:29
              
              2009/08/08 12:58:44
              
              2009/08/07 23:03:24 (21068)
              
              2009/08/06 23:03:35 (21053)
              
              2009/08/05 23:03:49 (21036)
              
              2009/08/04 23:03:32 (21018)
              
              2009/08/03 23:04:25 (21002)
              
              2009/07/31 23:03:37 (20975)
              
              2009/07/30 23:03:15 (20972)
              
              2009/07/29 23:03:37
              
              2009/07/28 23:03:48 (20948)
              
              2009/07/27 23:03:43 (20926)
              
              2009/07/24 23:03:49 (20918)
              
              2009/07/23 23:03:58 (20905)
              
              2009/07/22 23:03:12
              
              2009/07/21 23:04:04 (20855)
              
              2009/07/20 23:03:49 (20836)
              
              2009/07/20 12:49:31 (20829)
              
              2009/07/17 23:03:03 (20814)
              
              2009/07/16 23:03:28 (20801)
              
              2009/07/15 23:03:02
              
              2009/07/15 10:38:55 (20767)
              
              2009/07/14 23:02:33
              
              2009/07/14 17:11:39
              
              2009/07/13 23:03:30
              
              2009/07/13 12:33:35
              
              2009/07/11 23:02:43 (20727.1)
              
              2009/07/10 23:02:52
              
              2009/07/10 13:24:11 (20719)
              
              2009/07/09 23:03:47
              
              2009/07/08 23:03:30 (20674)
              
              2009/07/08 13:48:54 (20662)
              
              2009/07/08 13:23:58
              
              2009/07/07 23:03:01
              
              2009/07/06 23:03:31 (20612)
              
              2009/07/04 23:02:51 (20582.1)
              
              2009/07/03 23:03:46
              
              2009/07/03 11:09:57 (20534)
              
              2009/07/03 09:26:38 (20529)
              
              2009/07/02 23:03:37
              
              2009/07/01 23:03:38
              
              2009/06/30 23:03:20
              
              2009/06/29 23:03:02
              
              2009/06/28 23:02:41 (20421.2)
              
              2009/06/27 23:02:40
              
              2009/06/26 23:03:18
              
              2009/06/25 23:03:19
              
              2009/06/24 23:03:37 (20383)
              
              2009/06/23 23:03:54
              
              2009/06/22 23:03:54
              
              2009/06/22 12:18:42
              
              2009/06/20 23:02:45 (20302.1)
              
              2009/06/19 23:03:34
              
              2009/06/18 23:03:59 (20298)
              
              2009/06/18 10:33:14
              
              2009/06/17 23:03:39
              
              2009/06/17 16:08:50
              
              2009/06/17 14:10:07 (20217)
              
              2009/06/16 23:03:31 (20193)
              
              2009/06/15 23:04:11
              
              2009/06/14 23:03:04 (20096)
              
              2009/06/13 23:02:48 (20091)
              
              2009/06/12 23:03:04 (20087)
              
              2009/06/12 10:56:01 (20059)
              
              2009/06/11 23:03:53
              
              2009/06/10 23:03:21 (20002)
              
              2009/06/09 23:03:10 (19951)
              
              2009/06/08 23:03:18 (19912)
              
              2009/06/05 23:02:49 (19885)
              
              2009/06/04 23:02:42 (19880)
              
              2009/06/03 23:03:19 (19850)
              
              2009/06/02 23:02:52
              
              2009/06/01 23:03:44 (19787)
              
              2009/05/29 23:03:22 (19750)
              
              2009/05/28 23:03:12
              
              2009/05/28 13:27:16
              
              2009/05/27 23:03:44 (19681)
              
              2009/05/26 23:03:37 (19635)
              
              2009/05/26 08:00:10 (19599)
              
              2009/05/25 23:03:30 (19597)
              
              2009/05/25 13:19:20
              
              2009/05/24 23:02:57 (19546.1)
              
              2009/05/23 23:03:32
              
              2009/05/22 23:03:40
              
              2009/05/21 23:03:06 (19530)
              
              2009/05/20 23:03:28 (19516)
              
              2009/05/20 08:26:43 (19488)
              
              2009/05/19 23:04:07
              
              2009/05/18 23:03:49 (19429)
              
              2009/05/16 23:04:03 (19391)
              
              2009/05/15 23:03:34 (19387)
              
              2009/05/14 23:03:43 (19319)
              
              2009/05/13 23:03:33 (19255)
              
              2009/05/12 23:03:45 (19200)
              
              2009/05/11 23:03:10 (19158)
              
              2009/05/08 23:03:01 (19136)
              
              2009/05/08 11:14:33
              
              2009/05/07 23:03:31 (19095)
              
              2009/05/06 23:03:48 (19052)
              
              2009/05/05 23:03:29 (18992)
              
              2009/05/04 23:03:04
              
              2009/04/30 23:02:58 (18907)
              
              2009/04/29 23:02:40
              
              2009/04/28 23:02:44
              
              2009/04/27 23:03:41 (18788)
              
              2009/04/27 11:11:20 (18765)
              
              2009/04/27 07:50:37
              
              2009/04/26 23:02:18
              
              2009/04/25 23:02:48
              
              2009/04/24 23:03:23
              
              2009/04/24 11:26:43
              
              2009/04/24 08:48:58
              
              2009/04/23 23:04:05
              
              2009/04/23 13:59:33 (18700)
              
              2009/04/22 23:03:05 (18677)
              
              2009/04/22 09:18:13 (18604)
              
              2009/04/21 23:03:51
              
              2009/04/21 15:00:38
              
              2009/04/20 23:03:22 (18551)
              
              2009/04/17 23:02:50 (18518)
              
              2009/04/17 07:49:22 (18485)
              
              2009/04/16 23:03:47
              
              2009/04/15 23:03:41 (18449)
              
              2009/04/14 23:02:49 (18413)
              
              2009/04/10 23:03:14 (18366)
              
              2009/04/09 23:03:21 (18365)
              
              2009/04/08 23:03:13 (18355)
              
              2009/04/07 23:03:18 (18324)
              
              2009/04/06 23:04:27 (18277)
              
              2009/04/05 23:02:11
              
              2009/04/04 23:02:07
              
              2009/04/03 23:03:25
              
              2009/04/02 23:03:10
              
              2009/04/01 23:03:42 (18122)
              
              2009/03/31 23:04:22 (18075)
              
              2009/03/30 23:03:14 (18011)
              
              2009/03/27 23:03:29 (17962)
              
              2009/03/26 23:03:37 (17939)
              
              2009/03/25 23:03:30 (17916)
              
              2009/03/24 23:03:25 (17868)
              
              2009/03/23 23:03:27 (17814)
              
              2009/03/20 23:03:46 (17779)
              
              2009/03/19 23:03:01 (17734)
              
              2009/03/18 23:03:53 (17683)
              
              2009/03/17 23:03:50
              
              2009/03/16 23:03:36
              
              2009/03/14 23:03:12 (17574)
              
              2009/03/13 23:03:52 (17572)
              
              2009/03/12 23:03:43 (17550)
              
              2009/03/11 23:03:30
              
              2009/03/10 23:04:19
              
              2009/03/09 23:03:26
              
              2009/03/07 23:04:39 (17398)
              
              2009/03/06 23:04:14 (17396)
              
              2009/03/06 02:23:46 (17362)
              
              2009/03/05 23:03:45
              
              2009/03/05 21:58:46
              
              2009/03/05 19:45:53
              
              2009/03/04 23:02:57 (17318)
              
              2009/03/04 15:35:41
              
              2009/03/04 09:28:40
              
              2009/03/03 23:03:56
              
              2009/03/02 23:03:18 (17246)
              
              2009/03/02 15:50:30 (17242)
              
              2009/02/27 23:03:35 (17204)
              
              2009/02/26 23:03:22 (17187)
              
              2009/02/25 23:04:00 (17172)
              
              2009/02/24 23:03:30 (17149)
              
              2009/02/24 12:59:19
              
              2009/02/24 07:38:51 (17121)
              
              2009/02/20 23:03:55 (17081)
              
              2009/02/19 23:03:55 (17053)
              
              2009/02/18 23:04:04 (17027)
              
              2009/02/17 23:07:54 (16999)
              
              2009/02/16 23:05:37 (16966)
              
              2009/02/16 13:27:15 (16950)
              
              2009/02/13 23:07:01 (16934)
              
              2009/02/13 12:48:13 (16923)
              
              2009/02/12 23:04:30 (16916)
              
              2009/02/12 15:07:51 (16903)
              
              2009/02/11 23:04:45 (16888)
              
              2009/02/11 16:40:54 (16885)
              
              2009/02/11 12:30:11 (16870)
              
              2009/02/10 23:07:06 (16853)
              
              2009/02/09 23:07:09
              
              2009/02/08 23:05:22 (16781)
              
              2009/02/06 23:05:43 (16780)
              
              2009/02/05 23:07:27 (16746)
              
              2009/02/04 23:06:11
              
              2009/02/03 23:05:58 (16680)
              
              2009/02/02 23:06:16 (16632)
              
              2009/01/30 23:05:54 (16612)
              
              2009/01/29 23:05:30 (16589)
              
              2009/01/28 23:04:57
              
              2009/01/27 23:05:55
              
              2009/01/26 23:06:01
              
              2009/01/23 23:06:33 (16487)
              
              2009/01/22 23:05:11
              
              2009/01/22 10:27:26
              
              2009/01/21 23:06:26
              
              2009/01/20 23:05:13
              
              2009/01/19 23:07:24
              
              2009/01/16 23:07:01 (16300)
              
              2009/01/15 23:07:45 (16238)
              
              2009/01/15 10:58:46 (16167)
              
              2009/01/14 23:04:44 (16152)
              
              2009/01/13 23:07:19 (16105)
              
              2009/01/12 23:05:20 (16046)
              
              2009/01/10 23:03:31 (15999)
              
              2009/01/08 23:06:01
              
              2009/01/07 23:05:22
              
              2009/01/06 23:03:53 (15890.1)
              
              2009/01/05 23:05:59
              
              2009/01/05 10:23:05
              
              2009/01/04 23:02:50
              
              2009/01/03 23:02:38
              
              2009/01/02 23:05:15
              
              2008/12/24 23:04:58 (15828)
              
              2008/12/23 23:05:21
              
              2008/12/22 23:05:10 (15805)
              
              2008/12/20 23:03:28 (15780)
              
              2008/12/19 23:05:02 (15778)
              
              2008/12/18 23:05:08 (15741)
              
              2008/12/18 12:12:27 (15714)
              
              2008/12/17 23:05:40 (15702)
              
              2008/12/16 23:05:55 (15673)
              
              2008/12/15 23:05:04 (15647)
              
              2008/12/12 23:05:45 (15612)
              
              2008/12/11 23:07:02
              
              2008/12/10 23:05:19 (15521)
              
              2008/12/09 23:05:55
              
              2008/12/09 09:44:08 (15429)
              
              2008/12/08 23:04:19
              
              2008/12/05 23:05:02 (15365)
              
              2008/12/05 10:32:00
              
              2008/12/04 23:04:39 (15315)
              
              2008/12/03 23:05:36 (15289)
              
              2008/12/02 23:05:20 (15259)
              
              2008/12/01 23:07:01
              
              
              
              
              
              
              
              
              
              
              
              
              
              
              Build Results
              Unit Test Results
              Auto Test Results
              XML Log File
              Metrics
              Control Panel
              
              
              
              
              
              BUILD COMPLETE
              -
              27482
              
              
              
              Date of build:
              
              05/13/2010 23:04:47
              
              
              
              Time to build:
              
              85 minutes 24 seconds
              
              
              
              Last changed:
              
              05/13/2010 18:16:26
              
              
              
              Last log entry:
              
              POK-8110, POK-8134
                       GoToTable fix
              
              
              
              
              Build Artifacts
              
              Deploy this build
              
              Deliver this build internally
              
              Deliver this build to shelf
              
              
              
              
              
              
              
              td.header { background-color:#555555; color: #dddddd; ; font-family:arial,helvetica,sans-serif; font-size:10pt }
                          td.error { color: #cc0000; font-family:system; font-size:8pt }
                          tr.odd { background-color:#eeeeee }
                          tr.even { background-color:#ffffff }
              
              
              
              
              
              Unit Tests: (7)
              
              
              
              All Tests Passed
              
              
              
              
              
              
              
              
              
              
              
              
              
              
              
              
              
              
              Modifications since last successful build:
              (3)
              
              
              
              Revision
              
              Date
              
              Author
              
              Comment
              
              tr.added {background-color:#ddffdd;} 
                          tr.deleted {background-color:#ffdddd;} 
                          tr.modified {background-color:#ccccff;} 
                          tr.header {background-color:#666666;} 
                          td.header {font-size:10pt; color:#eeeeee;} 
                          td.comment {font-size:10pt; color:#000000; background-color:#bbbbbb;}
              
              27479
              
              05/13/2010 13:34:58
              
              sarutt
              
              POK-8130: [Systemtest 7.3.3 C/S] unlock time for SVS. Fixed time format.
              
              
              
              /trunk/src/servers/userhandler/userhandler_loginout.cpp
              
              modified
              
              
              
              
              27481
              
              05/13/2010 17:02:23
              
              gleyur
              
              POK-8139, POK-7851
              Removed commenting on code checked in earlier
              
              
              
              /trunk/src/flash_client/src/classes/com/eclipsesp/pokerclient/lobby/tabs/TournamentInfoScreen.as
              
              modified
              
              
              
              
              27482
              
              05/13/2010 18:16:26
              
              gleyur
              
              POK-8110, POK-8134
              GoToTable fix
              
              
              
              /trunk/src/flash_client/src/classes/com/eclipsesp/pokerclient/core/tablemanager/TableManagerModel.as
              
              modified
              
              
              
              
              
              
              
              
              
              
              
              
              
              
              
              
              
              
              
              
              Test for control before IF
              Build Failed
              Deploy page url is: None
              >>>

              Comment

              • Glenton
                Recognized Expert Contributor
                • Nov 2008
                • 391

                #8
                Hi

                So you're talking about line 33 in your most recently posted code? I'm sorry, but I really don't have time to go through your whole code. Can you please change line 32 to "print data.parser, type(data.parse r)" and show us what it gives?

                Comment

                • dbphydb
                  New Member
                  • Apr 2010
                  • 22

                  #9
                  I changed line 32
                  Code:
                  # Build url for Deploy page
                  def get_deploy_url():
                      url = URL + "/buildresults/Poker-TTM_%s_nightly_build" % branch
                      print "Latest build url for this branch is: %s" % url
                      
                      parser = DataParser()
                      parser.feed(urlopen(url).read())
                      parser.close()
                      parser.data
                      
                      print data.parser, type(data.parser)
                      if parser.data:
                          print "Data in parser exists"
                          if "BUILD COMPLETE" in parser.data:
                              print "BUILD COMPLETE found"
                              for link in get_links(url):
                                  if link["href"].startswith("Deploy"):
                                      return "%s/%s" % (URL, link["href"])
                      else:
                          print "Build Failed"
                  Got the below error

                  Code:
                  Traceback (most recent call last):
                    File "C:\build_complete.py", line 83, in <module>
                      final_url = get_destination_url()
                    File "C:\build_complete.py", line 45, in get_destination_url
                      url = get_deploy_url()
                    File "C:\build_complete.py", line 32, in get_deploy_url
                      print data.parser, type(data.parser)
                  NameError: global name 'data' is not defined

                  Comment

                  • Glenton
                    Recognized Expert Contributor
                    • Nov 2008
                    • 391

                    #10
                    Sorry, I meant parser.data.

                    Comment

                    • dbphydb
                      New Member
                      • Apr 2010
                      • 22

                      #11
                      <type 'str'>

                      Comment

                      • Glenton
                        Recognized Expert Contributor
                        • Nov 2008
                        • 391

                        #12
                        Okay. So parser.data is an empty string. That's where the problem is. Is DataParser a class you made? I don't see any of the code for that. Is it possible that you've made the class such that the first time you call the data method it returns the string, and subsequent calls return an empty string?

                        Let me know about DataParser.

                        Comment

                        • dbphydb
                          New Member
                          • Apr 2010
                          • 22

                          #13
                          No, i picked this piece of code from google. What the below class does is: prints out all the text between <body></body> tags in the HTML of that webpage.

                          Code:
                          class DataParser(HTMLParser):
                              def handle_data(self, data):
                                  self.data = data.strip()
                                  if data:
                                      print self.data
                          If you see in the output for print self.data --- All text between <body> and </body> tag is displayed which includes BUILD COMPLETE text also.
                          But the class is not able to return this and hence the if fails.

                          Comment

                          • Glenton
                            Recognized Expert Contributor
                            • Nov 2008
                            • 391

                            #14
                            Well, it seems that you need to figure out what's wrong with the class - either your usage of it is at fault, or it is buggy. If you want help with that, perhaps you can post the relevant bit of the class.

                            Comment

                            • dbphydb
                              New Member
                              • Apr 2010
                              • 22

                              #15
                              But it is printing out all the text on that webpage.I've verified if all text appearing on the webpage is printed (print self.data does this). So i am not sure if the code has bugs.
                              Is there any reason for parser.data to not have the data when out of the class?

                              Comment

                              Working...