Page 47 of 47 FirstFirst ... 37454647
Results 461 to 467 of 467

Thread: Conky Google Calendar Python Script

  1. #461
    Join Date
    Feb 2010
    Location
    SR11 Cockpit
    Beans
    Hidden!

    Re: Conky Google Calendar Python Script

    Quote Originally Posted by Walkerpt View Post
    Um esclarecimento.
    Li todo este forum tentei as varias soluções mas nenhuma resolveu o problema.
    No entanto para que se saiba o script roda no meu Uuntu 11.10 (unity).
    E ao Sábado é sempre feriado .

    Português > Inglês

    A clarification.
    I read all this forum tried the various solutions but none solved the problem.
    However, for knowing the script runs on my Uuntu 11.10 (unity).
    And Saturday is always holiday .
    Code:
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 17: ordinal not in range
    O á em Sáb talvez?

  2. #462
    Join Date
    Aug 2008
    Beans
    5

    Re: Conky Google Calendar Python Script

    Quote Originally Posted by Sector11 View Post
    Code:
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 17: ordinal not in range
    O á em Sáb talvez?
    Sector11 Português, Brasileiro,

    Sobre o problema, também penso que é esse o problema, tal como o xablins (post 457) e antes também o vancheese (post 453) com os ó, neste último caso a sugestão dada até por Sector11 aqui não resolve pois já está considerada, e a outra também refiro no meu post inicial, por isso aqui o problema mantêm-se e sem que eu perceba como o resolver.

    Português>English

    About the problem, I also think that this is the problem, such as xablins (post 457) and also before vancheese (post 453) with O in the latter case the suggestion given by Sector11 here does not solve it already considered, and the other also mean in my initial post, so here the question remains open and without my knowing how to solve it.

  3. #463
    Join Date
    Feb 2010
    Location
    SR11 Cockpit
    Beans
    Hidden!

    Re: Conky Google Calendar Python Script

    Quote Originally Posted by Walkerpt View Post
    Sector11 Português, Brasileiro,
    Canadian

    Quote Originally Posted by Walkerpt View Post
    Sobre o problema, também penso que é esse o problema, tal como o xablins (post 457) e antes também o vancheese (post 453) com os ó, neste último caso a sugestão dada até por Sector11 aqui não resolve pois já está considerada, e a outra também refiro no meu post inicial, por isso aqui o problema mantêm-se e sem que eu perceba como o resolver.

    Português>English

    About the problem, I also think that this is the problem, such as xablins (post 457) and also before vancheese (post 453) with O in the latter case the suggestion given by Sector11 here does not solve it already considered, and the other also mean in my initial post, so here the question remains open and without my knowing how to solve it.
    Sorry - I did not see the other posts. I have no answer - yet - I will continue to look.

    Lamentable - no vi los otros "posts". No tengo ninguna respuesta - aún - seguiré mirando.

  4. #464
    Join Date
    Jan 2012
    Beans
    1

    Re: Conky Google Calendar Python Script

    Hiding certain events can be misleading. Actually, I'd better like if the script would lose some single, problematic letters... And so I made this horrible, little fix.

    How to use? Save the following as horribleFix.patch and check whether this fix apply:
    $ patch --dry-run -p1 -i horribleFix.patch /usr/share/conkygooglecalendar/conkyGoogleCalendar.py
    If this prints "patching file /usr/share/conkygooglecalendar/conkyGoogleCalendar.py" or similar, then everything is OK. Do real fixing by calling as root:
    # patch -p1 -i horribleFix.patch /usr/share/conkygooglecalendar/conkyGoogleCalendar.py

    As some say -- this works for me.

    Code:
    *** /usr/share/conkygooglecalendar/conkyGoogleCalendar.py	2012-01-12 02:10:42.000000000 +0100
    --- .conky/myConkyGCalMod.py	2012-01-12 02:29:10.038323060 +0100
    ***************
    *** 432,438 ****
                  starttime = self.getDatetimeString(starttime)
                  endtime = self.getDatetimeString(endtime)
              
    !         return starttime, endtime, completetime, duration
      
          def getDatetimeString(self,whendatetime, format=None):
      
    --- 432,440 ----
                  starttime = self.getDatetimeString(starttime)
                  endtime = self.getDatetimeString(endtime)
              
    !         def safeUnicode(x):
    !             return unicode(x is not None and str(x) or "", errors='ignore')
    !         return safeUnicode(starttime), safeUnicode(endtime), safeUnicode(completetime), safeUnicode(duration)
      
          def getDatetimeString(self,whendatetime, format=None):
      
    ***************
    *** 677,683 ****
                                      #who = self.getWrappedText(who, self.options.maxwidth, indent)
      
                          # output event data using the template
    !                     output = self.getOutputFromTemplate(template, title, starttime, endtime, location, description, who)
      
                          output = self.getMadeSafeOutput(output)
                          print output #.encode("utf-8")
    --- 678,686 ----
                                      #who = self.getWrappedText(who, self.options.maxwidth, indent)
      
                          # output event data using the template
    !                     def safeUnicode(x):
    !                         return unicode(x is not None and x or "", errors='ignore')
    !                     output = self.getOutputFromTemplate(template, safeUnicode(title), starttime, endtime, location, safeUnicode(description), who)
      
                          output = self.getMadeSafeOutput(output)
                          print output #.encode("utf-8")

  5. #465
    Join Date
    Oct 2010
    Location
    Sweden
    Beans
    616
    Distro
    Ubuntu 12.04 Precise Pangolin

    Question Re: Conky Google Calendar Python Script

    I have a question for anyone using Ubuntu 12.04.
    Are you able to change colors in the conky templates that are used in a number of K's scripts?

    Code:
     ${color2}
    or

    Code:
    ${color yellow}
    commands only give me text in the conky that is identical to the code I enter in the template. That is, I see ${color2} on the screen.
    Thank you,
    GG -----------
    GUI we don't need no stinking GUI: A collection of Bash scripts
    Mutt (email), cmus (music),Google Calendar and Google Tasks cli

  6. #466
    Join Date
    Jul 2008
    Location
    Madrid, Spain
    Beans
    38
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Conky Google Calendar Python Script

    Hi there,

    I added a few lines to the getOutputFromTemplate method to avoid the utf8 problem. I didn't want to spend a lot of time in it, so the code is not perfect, but it solved the problem:

    def getOutputFromTemplate(self, template, title, starttime, endtime, location, description, who):

    try:

    output = template

    if title == None or title.strip() == "":
    output = self.removeLineByString(output,"[title]")
    else:
    title = title.decode('utf8')
    output = output.replace("[title]",title)

    if location == None or location.strip() == "":
    output = self.removeLineByString(output,"[location]")
    else:
    location = location.decode('utf8')
    output = output.replace("[location]",location)

    if description == None or description.strip() == "":
    output = self.removeLineByString(output,"[description]")
    else:
    description = description.decode('utf8')
    output = output.replace("[description]",description)

    if who == None or who.strip() == "":
    output = self.removeLineByString(output,"[who]")
    else:
    #output = output.replace("[who]",";".join(who))
    who = who.decode('utf8')
    output = output.replace("[who]",who)

    starttime, endtime, completetime, duration = self.getFormattedEventTimes(starttime, endtime)

    starttime = starttime.decode('utf8')
    output = output.replace("[starttime]",starttime)
    endtime = endtime.decode('utf8')
    output = output.replace("[endtime]",endtime)

    if output.find("[completetime]") != -1:
    completetime = completetime.decode('utf8')
    output = output.replace("[completetime]",completetime)

    if output.find("[duration]") != -1:
    duration = duration.decode('utf8')
    output = output.replace("[duration]",duration)

    # get rid of any excess crlf's and add just one
    #output = output.rstrip(" \n")
    #output = output + "\n"

    return output

    except Exception,e:
    self.logError("getOutputFromTemplate:Unexpected error:" + traceback.format_exc())
    return ""
    Regards
    Bruce Schneier : "We need business models that respect the natural laws of the digital world instead of fighting them"

  7. #467
    Join Date
    Sep 2011
    Beans
    1

    Re: Conky Google Calendar Python Script

    Thanks primolarry, this fixed the utf8 problem for me but I needed to make an additional modification on the line (#691 after your modifications):

    print output #.encode("utf-8")

    Simply remove the comment to get:

    print output.encode("utf-8")

Page 47 of 47 FirstFirst ... 37454647

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •