GithubHelp home page GithubHelp logo

UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position 20: ordinal not in range(128) about ical_to_gcal_sync HOT 11 CLOSED

adambarnett52 avatar adambarnett52 commented on July 24, 2024
UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position 20: ordinal not in range(128)

from ical_to_gcal_sync.

Comments (11)

andrewramsay avatar andrewramsay commented on July 24, 2024

Will have a look at this but am travelling until the 23rd and only have a phone with me, so unlikely to be able to do much before then! In the meantime you could try commenting out that line, it's just logging by the looks of it. Might work ok without trying to print whatever the problematic characters are.

from ical_to_gcal_sync.

adambarnett52 avatar adambarnett52 commented on July 24, 2024

from ical_to_gcal_sync.

andrewramsay avatar andrewramsay commented on July 24, 2024

u\xa0 is the Unicode "non-breaking space" character, I guess this might be an event name originally pasted from a browser or Word or some other rich-text source?

Anyway, do you happen to be using Python 2? I was trying to reproduce this but couldn't until I thought to try Python 2 instead of Python 3.5 as I have on my RPi. It seems like only Python 2 throws up errors like this (also when deleting an event with non-ascii characters), Python 3 doesn't complain at all so I guess some of the many string-handling updates from 2->3 are responsible.

If you can easily update your copy to run with Python 3.x I think it will fix this. I just realised I haven't noted in the README that I've only tested the script with 3.x, so I'll do that soon.

from ical_to_gcal_sync.

adambarnett52 avatar adambarnett52 commented on July 24, 2024

from ical_to_gcal_sync.

andrewramsay avatar andrewramsay commented on July 24, 2024

When I get a chance I'll try to fix the 2.7 issue in a way that still works with 3.x, shouldn't be too difficult

from ical_to_gcal_sync.

andrewramsay avatar andrewramsay commented on July 24, 2024

If you want to stick with Python 2.7, try the unicodefix branch I just created. The changes are minimal but I think they should prevent these issues with event names cropping up without affecting Python 3.x.

Let me know how it goes, if it seems OK I'll merge it back to the master branch.

from ical_to_gcal_sync.

adambarnett52 avatar adambarnett52 commented on July 24, 2024

seems to work correctly, thanks
Any suggestion on how to avoid 403 errors, when makes too many requests
I am sycing 3 cals to gsuite, is there a way to just do the next 24 hours of events ?

from ical_to_gcal_sync.

andrewramsay avatar andrewramsay commented on July 24, 2024

seems to work correctly, thanks

Good, will merge that branch back in then.

Any suggestion on how to avoid 403 errors, when makes too many requests
I am sycing 3 cals to gsuite, is there a way to just do the next 24 hours of events ?

How are you scheduling them? Just running the script 3 times consecutively? You might be able to work around it to some extent by:

  1. Scheduling each individual sync at longer intervals (maybe an hour apart?)
  2. Increasing the API_SLEEP_TIME value in config.py, which will reduce the rate of API requests the script submits at the cost of making each run take longer.

At some point next week I can look into adding an optional filter to be applied to the initial collection of iCal events. That would allow for removing anything >24 hours ahead, as well as other criteria like "only include events with some string in their name".

from ical_to_gcal_sync.

adambarnett52 avatar adambarnett52 commented on July 24, 2024

Hi,

{quote}
How are you scheduling them? Just running the script 3 times consecutively? You might be able to work around it to some extent by:
{quote}
Yes a jenkins job. I will up the timeout

{quote}
At some point next week I can look into adding an optional filter to be applied to the initial collection of iCal events. That would allow for removing anything >24 hours ahead, as well as other criteria like "only include events with some string in their name
{quote}
Sounds good, i guess i only really care about the next 24 hours ( or todays events ) if that makes it easier. The reason is that i am syn'ing from an ical into gsuite for Zoom to pick up the data and Zoom only shows one days worth of events on its display

from ical_to_gcal_sync.

andrewramsay avatar andrewramsay commented on July 24, 2024

OK, I'll just keep it simple in that case: try the filterevents branch I've just pushed. There's a new value in config.py called ICAL_DAYS_TO_SYNC. The default is 0 which preserves the current behaviour, but if you set it to 1 it should filter out events retrieved from the iCal feed with dates >= 1 day in the future. Only tested it briefly but it seemed to work for me.

from ical_to_gcal_sync.

adambarnett52 avatar adambarnett52 commented on July 24, 2024

Perfect, worked like a charm

from ical_to_gcal_sync.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.