Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.tele.dk!feed118.news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'filter,': 0.09; 'finished.': 0.09; 'output,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'url:github': 0.09; 'runs': 0.10; 'python': 0.11; 'jan': 0.12; 'suggest': 0.14; 'programmer,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject:when': 0.16; 'skip:# 20': 0.16; 'so.': 0.16; 'wrote:': 0.18; 'library': 0.18; 'normally': 0.19; 'help.': 0.21; 'import': 0.22; 'print': 0.22; 'load': 0.23; 'header:User- Agent:1': 0.23; 'error': 0.23; 'code:': 0.26; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; "i'm": 0.30; 'code': 0.31; "skip:' 10": 0.31; 'cgi': 0.31; 'fault': 0.31; 'running': 0.33; 'could': 0.34; 'subject:with': 0.35; 'skip:u 20': 0.35; 'google': 0.35; 'there': 0.35; 'idle': 0.36; 'doing': 0.36; 'url:org': 0.36; 'project': 0.37; 'skip:o 20': 0.38; 'displays': 0.38; 'filter': 0.38; 'skip:[ 10': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'received:org': 0.40; 'skip:u 10': 0.60; 'received:173': 0.61; 'here': 0.66; 'webpage': 0.68; 'link:': 0.72; 'guaranteed': 0.75; 'commenting': 0.84; 'preventing': 0.84; 'received:fios.verizon.net': 0.84; 'subject:try': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: BLANK PAGE when i try Filtering Adsense with abpy Date: Sun, 22 Dec 2013 16:13:22 -0500 References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-173-75-254-207.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 50 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1387746820 news.xs4all.nl 2958 [2001:888:2000:d::a6]:47156 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:62553 On 12/22/2013 12:20 PM, em rexhepi wrote: > I know is my fault i'm no good programmer, I'm a begginer that's why i need your help. > > I have a python 3.3 project to be finished. I did what i could there is not much help on google about this topic. > > The project is to load a webpage from any website and filter the ads. > I'm using ABPY library to filter, here is the link: > https://github.com/atereshkin/abpy <- needs to be converted in python 3.x it is on 2.x > easylist.txt link: https://easylist-downloads.adblockplus.org/easylist.txt > > > When I use my code it just displays nothing > > My code: > #!/usr/local/bin/python3.1 Please update your Python 3 if you are not in a straightjacket preventing you from doing so. > import cgitb;cgitb.enable() I suggest commenting this out and running normally in a console or Idle so you are guaranteed to see output, including error tracebacks. Only use cgi when this runs successfully in normal mode. > import urllib.request > response = urllib.request.build_opener() > response.addheaders = [('User-agent', 'Mozilla/5.0')] > response = urllib.request.urlopen("www.youtube.com";) The ; is a SyntaxError and Python exits. See above. > html = response.read() > > from abpy import Filter > with open("easylist.txt") as f: > f = Filter(file('easylist.txt')) > f.match(html) > > > print("Content-type: text/html") > print() > print (html) > -- Terry Jan Reedy