Pls help me...I want to save data to my database but I am unable to

Chris Angelico rosuav at gmail.com
Sat Jan 25 14:22:44 EST 2014


On Sun, Jan 26, 2014 at 6:00 AM, Max Cuban <edzeame at gmail.com> 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)



More information about the Python-list mailing list