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 trial

Python

Pulkit Kumar
Pulkit Kumar
2,052 Points

ImportError: bad magic number in 'time': b'\x03\xf3\r\n'

Kenneth Love I am getting the above error when i am simply importing datetime library.

i have installed python 3.4.2 i guess and i use a mac so can please tell me how can i rectify it?

2 Answers

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

Uh....wow.

A bit of Googling leads me to asking if you were using a different version of Python for awhile and then upgraded to 3.4.2 recently? If so, do you have a version of the file where you import datetime that was run with the old version? If so, you should have a file with the extension .pyc. Delete any .pyc files you have and try again.

Pulkit Kumar
Pulkit Kumar
2,052 Points
  worked perfectly. Thanks a lot :D
Quentin Vadon
Quentin Vadon
2,263 Points

I had the same problem, and the solution works too, thanks !