vbe0201 / 3DS.py

Python on your Nintendo 3DS
Apache License 2.0
133 stars 7 forks source link

OSError on script load. (time package error?) #9

Open ghost opened 4 years ago

ghost commented 4 years ago

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

vbe0201 commented 4 years ago

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.

Bluebotlabz commented 3 years ago

I use this instead of time.sleep:

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