From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steinar Bang Subject: Re: Minimal overhead Org-mode blogging system Date: Sun, 15 Jan 2012 19:08:54 +0100 Message-ID: <87pqek6dop.fsf@dod.no> 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> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:41863) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RmUVy-0007jP-Ud for emacs-orgmode@gnu.org; Sun, 15 Jan 2012 13:09:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RmUVx-0002f3-J4 for emacs-orgmode@gnu.org; Sun, 15 Jan 2012 13:09:10 -0500 Received: from lo.gmane.org ([80.91.229.12]:46978) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RmUVx-0002ew-8U for emacs-orgmode@gnu.org; Sun, 15 Jan 2012 13:09:09 -0500 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RmUVv-0001uk-1i for emacs-orgmode@gnu.org; Sun, 15 Jan 2012 19:09:07 +0100 Received: from cm-84.208.231.161.getinternet.no ([84.208.231.161]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 15 Jan 2012 19:09:07 +0100 Received: from sb by cm-84.208.231.161.getinternet.no with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 15 Jan 2012 19:09:07 +0100 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 >>>>> 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. But, it's something I wrote up quickly. Feel 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): File "reprise.py", line 258, in env.get_template('cloud.html')) File "reprise.py", line 140, in generate_tag_cloud maxFreq = 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): tags = sum([e['tags'] for e in entries], []) tag_freq = [{'tag': tag, 'freq': tags.count(tag)} for tag in set(tags) if tags.count(tag) > 3] maxFreq = max(t['freq'] for t in tag_freq) ... 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): tags = sum([e['tags'] for e in entries], []) tag_freq = [{'tag': tag, 'freq': tags.count(tag)} for tag in set(tags)] maxFreq = max(t['freq'] for t in tag_freq) ... but that just gave me a different error (division by zero): File "reprise.py", line 257, in env.get_template('cloud.html')) File "reprise.py", line 147, in generate_tag_cloud 'freq': t['freq']} for t in tag_freq] File "reprise.py", line 144, in normalize return min_r + (val - min_f) * (max_r - min_r) / float (max_f - min_f) Any ideas of how to proceed? Thanks! - Steinar