pythonwindowspermissionssleeprights

Windows, Python: time.sleep() permission error


In my Python Script, I am using the function time.sleep(10) to make the script sleep for 10 seconds. I am correctly importing the time module and the code works perfectly fine when running on MacOS.

Even the most basic approach doesn't work:

import datetime
import time

print(datetime.datetime.now())
time.sleep(10)
print(datetime.datetime.now())

When trying to run it on Windows, however, my Command Prompt displays something like „the client is missing a right“. I‘ve tried multiple things now, like moving the file to another directory (e.g. the Python directory) or trying it on the admin account... Nothing has helped. Also, it doesn't work on any of my other Windows machines either.

How can I solve that problem? Thanks in advance!


Solution

  • To fix it run it as admin. I am sorry, I don't know why it doesn't work from your admin account. And to run a .bat file as admin you can just righclick the file and run as admin. enter image description here