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 !