3DS.py icon indicating copy to clipboard operation
3DS.py copied to clipboard

OSError on script load. (time package error?)

Open ghost opened this issue 5 years ago • 2 comments

Here is the code that I put in main.py:

import time
import random

while True:
    print(random.random())
    time.sleep(1)

While this works in the normal Python interpreter on my PC, 3DS.py throws this error: 20200428_195406

ghost avatar Apr 29 '20 02:04 ghost

Hello, the first problem is caused due to random.random() depending on the broken hashlib module. This is a known issue and a corresponding fix has already been supplied to my fork of CPython, which is going to be used in the WIP rewrite of 3DS.py.

For the time.sleep error, the issue is known as well, but I haven't found the time to look deeper into it yet. That's why I'm going to leave this issue open as some sort of progress tracker until a patch has been supplied to my Python fork.

vbe0201 avatar Apr 29 '20 18:04 vbe0201

I use this instead of time.sleep:

def sleep(seconds):
    start = time.monotonic()
    while(time.monotonic() < start + seconds):
        pass