Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!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.013 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'exercise': 0.04; 'output': 0.05; 'subsequent': 0.05; 'smallest': 0.07; 'tries': 0.07; 'subject:help': 0.08; "'a'": 0.09; 'append': 0.09; 'paragraph,': 0.09; 'run,': 0.09; 'cc:addr:python-list': 0.11; 'jan': 0.12; '"every': 0.16; '(other': 0.16; '6:00': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'helps!': 0.16; 'demonstrate': 0.16; 'wrote:': 0.18; 'code,': 0.22; 'programming': 0.22; 'cc:addr:python.org': 0.22; 'earlier': 0.24; 'fine': 0.24; 'cc:2**0': 0.24; 'script': 0.25; 'post': 0.26; 'header:In-Reply- To:1': 0.27; 'point': 0.28; '[1]': 0.29; 'am,': 0.29; 'related': 0.29; 'database,': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'work.': 0.31; 'code': 0.31; 'easier': 0.31; '(maybe': 0.31; 'consequence': 0.31; 'terms.': 0.31; 'stuff': 0.32; 'run': 0.32; 'running': 0.33; '"the': 0.34; 'could': 0.34; 'problem': 0.35; "can't": 0.35; 'display': 0.35; 'problem.': 0.35; 'tool': 0.35; 'something': 0.35; 'case,': 0.35; 'hundreds': 0.35; 'one,': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'version': 0.36; 'subject:data': 0.36; 'shows': 0.36; 'detail': 0.37; 'too': 0.37; 'project': 0.37; 'list.': 0.37; 'being': 0.38; 'rather': 0.38; 'short': 0.38; 'anything': 0.39; "couldn't": 0.39; 'generating': 0.39; 'unable': 0.39; 'hope': 0.61; 'new': 0.61; 'simply': 0.61; 'first': 0.61; 'you.': 0.62; 'save': 0.62; 'making': 0.63; 'hours': 0.66; 'here': 0.66; '26,': 0.68; 'sound': 0.68; 'saving': 0.69; 'car': 0.72; "it'd": 0.84; 'scraping': 0.84; 'disposal': 0.91; 'dozen': 0.91; 'ice': 0.91; 'subject:want': 0.91; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=1dQaHCXkp3WZvdjT9zzdzT0utnlQrqphgES41Smklm4=; b=aJLeNPQjSrHPQgCp7D1lvCXcQ0OyjJfLtub+6i/Bm12+Sm0jWZTajKsyanxRIGsHMb Agzh17y18W6gfb6z8pX1fjZSmfV7LyTp01gTGQwHtS7hIiTuwSj/2Jo9M5eG7Uly4Iyg c9Z/l+wS+qAUa5wjjAHju9K/kaE3f9Ed/0iCP66nMra4rrZSpf7ftb3NOgKKQCUrCyDr ynL5rom5zC41hdrAWeZSie+kQPbG2QsTpuVBWxPz1IGLICV0RLOy351fZ72ys6XASVai l6eHNBxgQD5nyzzb2PZuR9EygBF5eLkpCzLFdu1v6ZaRaDyIzhd1jRaRCrqzFL1Ah/b4 rYiw== MIME-Version: 1.0 X-Received: by 10.68.106.130 with SMTP id gu2mr21079333pbb.59.1390677764416; Sat, 25 Jan 2014 11:22:44 -0800 (PST) In-Reply-To: References: Date: Sun, 26 Jan 2014 06:22:44 +1100 Subject: Re: Pls help me...I want to save data to my database but I am unable to From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 38 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1390677773 news.xs4all.nl 2912 [2001:888:2000:d::a6]:50035 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:64751 On Sun, Jan 26, 2014 at 6:00 AM, Max Cuban wrote: > This is my first programming pet project. I have the following script that > extracts links from specific sites and display them on the web(via django). > The script work fine but I'm unable to save any stuff in my database. > > Hence if I run the code, I get the output I want but then it always extracts > only new content. I will rather want to have the content scrapped earlier > saved to the database so that on subsequent run, it only scrap and append > ONLY new links to the list. At what point are you saving anything to the database? I'm not seeing it. This may be a consequence of there being simply too much code for the post - when you have a problem, try to post the smallest amount of code necessary to demonstrate that problem. If your problem is saving stuff to the database, create a project that simulates generating links (maybe just hard-codes a dozen of them), and tries to save them. Often, the exercise of making the small version actually shows you where the problem is, right there; and if it doesn't, it's much easier for us to see and help you. In this case, after reading your opening paragraph, the very first thing I did was to scan your code for a "commit" operation - but I couldn't find one, and I can't find any database work. BTW, the word you want here is "scrape" (other tenses "scraping" and "scraped"). Scrapping ("scrap", "scrapped" - pronounced with a short 'a' sound like "flapping") is destruction and disposal - "the wreckers are scrapping hundreds of smashed cars". Scraping (pronounced with a long 'a' sound like "trading" [1]) is running a tool over something to clean something else off - "every winter, car owners spend innumerable hours scraping ice off their windscreens" - and this is the word that's been picked up for "screen scraping" and related terms. Hope that helps! ChrisA [1] I could go into detail about single and double consonants if anyone's curious, but I don't think it'd help)