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

Completed

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)
print(dt)
0
1 comment
Avatar
Permanently deleted user

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

1

Please sign in to leave a comment.