1

I tried to run an old script which contains the following line:

from icalendar import UTC

This gave me the following error:

Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
ImportError: cannot import name UTC

So I checked out the change log of icalendar which states the following:

Renamed the UTC class to Utc, so it would not clash with the UTC object, since that rendered the UTC object unpicklable.

I changed UTC into Utc and still get the same error.

How can I get rid of this error?

ForceBru
  • 43,482
  • 10
  • 63
  • 98
Mehdi Nellen
  • 8,486
  • 4
  • 33
  • 48

2 Answers2

1

In the timezone support section of https://pypi.python.org/pypi/icalendar, it states that:

Instead of our own UTC tzinfo implementation we use pytz UTC tzinfo object now.

I would therefore suggest that you use:

from pytz import UTC

...instead of:

from icalendar import UTC
gtlambert
  • 11,711
  • 2
  • 30
  • 48
0

Python don't see your local directory:

  1. Check it: https://stackoverflow.com/a/339220/3260314

  2. Check your sys.path

    import sys.path print sys.path

If this hasn't your directory:

sys,path.insert(1, path)
Community
  • 1
  • 1
JRazor
  • 2,707
  • 18
  • 27