Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialKevin Nguyen
4,422 Pointsquestion on timezone
I cannot file what's wrong with this line of code. Thanks.
>>> import datetime
>>> pacific = datetime.timezone(datetime.timedelta(hours=-8))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
import datetime
moscow = datetime.timezone(datetime.timedelta(hours=4))
2 Answers
Kenneth Love
Treehouse Guest TeacherYour code passes the challenge step. I'm not sure what's going on in the shell snippet you posted above that. Is there more going on?
Quicken Loans
12,654 PointsGetting this exact same error on my macbook air...
Kenneth Love
Treehouse Guest TeacherIn Workspaces or coding on your actual computer?
Quicken Loans
12,654 Pointsactual computer, screen shot:
Kenneth Love
Treehouse Guest TeacherAh, you're in Python 2.7 which doesn't have datetime.timezone
. You'll need to use Python 3 or always use a library like pytz to handle timezones and timezone-aware datetime
s.