Data Parsing Old Website Python no error but no results when running

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • crm2017
    New Member
    • Nov 2015
    • 2

    Data Parsing Old Website Python no error but no results when running

    I am parsing an old state website for a project and I cannot get the python code to work.

    I have typed in the code I made back into the developer console and it works perfectly there but in python it just returns:

    C:\Python27\pyt hon.exe "C:/Users/corinne/PycharmProjects/scc docket/SCC V1.py"
    []

    Process finished with exit code 0



    The code I have created is:



    Code:
    from lxml import html
    import requests
    page = requests.get('http://www.scc.virginia.gov/docketsearch#dailyFilings')
    tree = html.fromstring(page.text)
    
    
    dailyFilings = tree.xpath('//*[contains(@class,"details-brief")]//td[1]/text()')
    print dailyFilings
    can anyone please help me??
    Last edited by Rabbit; Nov 5 '15, 11:26 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
  • dwblas
    Recognized Expert Contributor
    • May 2008
    • 626

    #2
    I get a "no module named lxml error". Are you using standard Python? Also some basic debugging should be done first. Print "page" and "tree"to see if those 2 lines are working. Generally I use urllib and BeautifulSoup (or roll my own) so don't know anything about lxml, but maybe someone else will know more.

    Comment

    • crm2017
      New Member
      • Nov 2015
      • 2

      #3
      Thanks for responding!

      I'm using JetBrains PyCharm 3.1 Community Edition.

      I have never used urlib and BeautifulSoup, are you able to give me a simple example of parsing using those?

      Comment

      • dwblas
        Recognized Expert Contributor
        • May 2008
        • 626

        #4
        A general tutorial http://swordstyle.com/func_test_tuto...tifulsoup.html but depends on what you want from the page. Also look at http://www.pythonforbeginners.com/py...soup-4-python/

        Comment

        Working...