emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] Introducing ical2org


From: KANEUCHI Tetsuya
Subject: Re: [Orgmode] Introducing ical2org
Date: Sun, 7 Mar 2010 08:49:25 +0900

Hi Doug,

On Sat, Feb 13, 2010 at 11:52 PM, Doug Hellmann <address@hidden> wrote:
> ical2org is a command line tool for exporting data from the Mac OS X
> application iCal so it can be used with org-mode.

Thank you very much for the very nice tool.

I've tried ical2org by installing with MacPorts' pip for Python 2.6
and found 2 problems.
And I made a patch for avoiding them for me.

1) Running without -o option, UnicodeEncodeError with non-ascii
events. Here is the traceback output.

Traceback (most recent call last):
  File 
"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/ical2org",
line 8, in <module>
    load_entry_point('ical2org==1.0.2', 'console_scripts', 'ical2org')()
  File 
"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/ical2org/app.py",
line 183, in main
    formatter.add_event(event)
  File 
"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/ical2org/format.py",
line 54, in add_event
    self.output.write(self.format_event(event))
UnicodeEncodeError: 'ascii' codec can't encode characters in position
3-32: ordinal not in range(128)

2) List index out of range error for description handling(I guess).
Here is the traceback output.

Traceback (most recent call last):
  File 
"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/ical2org",
line 8, in <module>
    load_entry_point('ical2org==1.0.2', 'console_scripts', 'ical2org')()
  File 
"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/ical2org/app.py",
line 183, in main
    formatter.add_event(event)
  File 
"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/ical2org/format.py",
line 54, in add_event
    self.output.write(self.format_event(event))
  File 
"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/ical2org/org.py",
line 63, in format_event
    lines.append('   - %s' % desc_lines[0])
IndexError: list index out of range


====
It's a patch to avoid these problems. It works for me.

diff -u orig/app.py ./app.py
--- orig/app.py 2010-03-07 07:29:17.000000000 +0900
+++ ./app.py    2010-03-07 08:19:51.000000000 +0900
@@ -167,7 +167,7 @@

active_only=options.active_only)

     # Process the calendar data
-    output = sys.stdout
+    output = codecs.getwriter('utf-8')(sys.stdout)
     if options.output_file_name:
         output = codecs.open(options.output_file_name, 'wt', 'UTF-8')
     try:
Binary files orig/app.pyc and ./app.pyc differ
diff -u orig/org.py ./org.py
--- orig/org.py 2010-03-07 07:31:49.000000000 +0900
+++ ./org.py    2010-03-07 08:25:27.000000000 +0900
@@ -60,8 +60,9 @@
 # Unicode error for PyATL calendar events.
         if getattr(event, 'description', None):
             desc_lines = event.description.value.splitlines()
-            lines.append('   - %s' % desc_lines[0])
-            lines.extend([ '     %s' % l for l in desc_lines[1:]])
+            if len(desc_lines) > 0:
+                lines.append('   - %s' % desc_lines[0])
+                lines.extend([ '     %s' % l for l in desc_lines[1:]])

         lines.append('')
         return '\n'.join(lines)


I hope this helps.

-- 
KANEUCHI Tetsuya




reply via email to

[Prev in Thread] Current Thread [Next in Thread]