I\'m writing a silly program in python for a friend that prints \"We are the knights who say \'Ni\'!\". then sleeps for 3 seconds, and then prints \"Ni!\" twenty times at ra
Apologies for the necropost but I ran into this problem too though in a slightly different way.
I was running time.time() with mod_python under Apache and Python . If I attempted to load the page with time.time() on it, it would fail complaining that "global name 'time' is not defined". However, if I ssh'd into my webserver and ran the exact same method from the command line, it would work.
In the end, restarting the Apache2 service fixed the issue. I'm not sure why this helped. I guess the module was unloaded at some point and then wouldn't reload, despite the import time command.
It's strange and a bit mysterious. Sorry I never hunted down the actual cause but hopefully this helps out the next person.