module 'pytz' has no attribute 'UTC' (Python)


I try to import pytz library in Python and have this error. In sublime text 3 everything works fine. What's wrong?

I've imported this library via pip install pytz and I also added this library in Settings -> Project -> Project Interpreter. None of this have helped.

The code:

import pytz
import datetime

dt = datetime.datetime(2018, 7, 18, 11, 41, 35, tzinfo=pytz.UTC)
1 comment
Comment actions Permalink

Found the issue. I had a file called 'pytz' in my wd. I've deleted it and the code now works


Please sign in to leave a comment.