From mboxrd@z Thu Jan 1 00:00:00 1970 From: Puneeth Chaganti Subject: Re: Minimal overhead Org-mode blogging system Date: Mon, 16 Jan 2012 16:54:53 -0600 Message-ID: References: <2011-12-04T17-22-10@devnull.Karl-Voit.at> <2011-12-08T01-25-36@devnull.Karl-Voit.at> <2011-12-08T15-13-31@devnull.Karl-Voit.at> <87pqek6dop.fsf@dod.no> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:58902) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RmvSS-0006mO-Nq for emacs-orgmode@gnu.org; Mon, 16 Jan 2012 17:55:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RmvSQ-00018a-3W for emacs-orgmode@gnu.org; Mon, 16 Jan 2012 17:55:20 -0500 Received: from mail-yx0-f169.google.com ([209.85.213.169]:50532) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RmvSQ-00018T-0y for emacs-orgmode@gnu.org; Mon, 16 Jan 2012 17:55:18 -0500 Received: by yenm10 with SMTP id m10so1535612yen.0 for ; Mon, 16 Jan 2012 14:55:17 -0800 (PST) In-Reply-To: <87pqek6dop.fsf@dod.no> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org On Sun, Jan 15, 2012 at 12:08 PM, Steinar Bang wrote: >>>>>> Puneeth Chaganti : > [snip!] >>>>>> https://github.com/punchagan/blog-files > >> I've added a short README that tries to include the things that you >> are looking for. =C2=A0But, it's something I wrote up quickly. =C2=A0Fee= l free >> to ask any specific questions. > > I've been trying to use it, but I keep running into issues with > reprise.pay. > > The latest one, is: > > Traceback (most recent call last): > =C2=A0File "reprise.py", line 258, in > =C2=A0 =C2=A0env.get_template('cloud.html')) > =C2=A0File "reprise.py", line 140, in generate_tag_cloud > =C2=A0 =C2=A0maxFreq =3D max(t['freq'] for t in tag_freq) > ValueError: max() arg is an empty sequence > > The code for this, is: > > def generate_tag_cloud(entries, template): > =C2=A0 =C2=A0tags =3D sum([e['tags'] for e in entries], []) > =C2=A0 =C2=A0tag_freq =3D [{'tag': tag, 'freq': tags.count(tag)} for tag = in set(tags) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if tags.count(tag)= > 3] > =C2=A0 =C2=A0maxFreq =3D max(t['freq'] for t in tag_freq) > =C2=A0 =C2=A0... > > I've debugged this with pdb (`M-x pdb'), and tag_freq is empty. > > If I'm interpreting the python code correctly (I don't know python...) > only those tags that have more than 3 occurrences will be in the > tag_freq collection...? > > My problem is that I have only one article, my first, so obviously the > tag_freq collection will stay emtpy, and reprise.py will crash... > > I tried removing the test, ie. > > def generate_tag_cloud(entries, template): > =C2=A0 =C2=A0tags =3D sum([e['tags'] for e in entries], []) > =C2=A0 =C2=A0tag_freq =3D [{'tag': tag, 'freq': tags.count(tag)} for tag = in set(tags)] > =C2=A0 =C2=A0maxFreq =3D max(t['freq'] for t in tag_freq) > =C2=A0 =C2=A0... > > but that just gave me a different error (division by zero): > > =C2=A0File "reprise.py", line 257, in > =C2=A0 =C2=A0env.get_template('cloud.html')) > =C2=A0File "reprise.py", line 147, in generate_tag_cloud > =C2=A0 =C2=A0'freq': t['freq']} for t in tag_freq] > =C2=A0File "reprise.py", line 144, in normalize > =C2=A0 =C2=A0return min_r + (val - min_f) * (max_r - min_r) / float (max_= f - min_f) > > Any ideas of how to proceed? This is totally home brew stuff. Sorry for the trouble you are having, in getting it to run. Try commenting out the lines 257, 258 in reprise.py and see if that works for you. I'll take a look later, and try to see if this can be improved. Thanks, Puneeth