getting an error while using time sleep method in python
Question: There is a weblogic python script that takes a thread dump and sleeps for 10
or 20 seconds then takes another one after time.sleep(30), thread dumps are
working fine, but the sleep method time.sleep(20) is not working.

Tried both `import time` and `from time import sleep` as well.

Getting this error below

    
    
    AttributeError: java package 'weblogic.time' has no attribute 'sleep'
    


Answer: The problem here is that the `weblogic.time` package is shadowing the stdlib
`time` module. So, when you try to `import time`, you're getting the former,
not the latter.

(And `weblogic.time` has nothing in it but a subpackage or module
`weblogic.time.common`, so you get an error trying to use its `sleep`
function. But that's probably a good thing—better than it had a function named
`sleep` that didn't do what you expected.)

If you were developing `weblogic` itself, I could explain how to not do that…
but if you're just using `weblogic`, that's not going to help you.

If you're doing something like `from weblogic import *` earlier, the solution
is simple: Just don't do that. Otherwise… it will be more complicated to work
around.

But if all you need to do is block your interpreter thread for 20 seconds, you
can do that with the Java `Thread.sleep(20000)`. See [this
tutorial](http://docs.oracle.com/javase/tutorial/essential/concurrency/sleep.html),
but really, you don't need to know much more than that the Java method takes
integer milliseconds instead of float seconds. And then you don't need `time`.

