Why does my import time give error module object is not callable
Question: I just want to use the import time function to get a timestamp from python.

    
    
    import time
    

I have this sample test code which works just fine on cloud 9.

    
    
    import time
    now = int(time.time() * 1000)
    print now
    

But it doesn't work on my mac. I get an error right on line 1.

    
    
    Python 2.7.11 (default, Mar 21 2016, 23:21:56) 
    [GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import time
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "time.py", line 2, in <module>
        now = int(time.time() * 1000)
    TypeError: 'module' object is not callable
    >>> 
    

Not sure what is going on here it is frustrating.


Answer: You have a file in your local directory called "time.py". Rename it.

