python2 import random throws OSError: [Errno 38] Function no

Development on core packages and the distribution goes on in here.

python2 import random throws OSError: [Errno 38] Function no

Postby grahams » Fri May 05, 2017 8:20 pm

In python2 I can not import random. The error seems to indicate an OS function is missing, but it does list the function.

# python2
Python 2.7.13 (default, Apr 24 2017, 20:01:05)
[GCC 6.3.1 20170306] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import random
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/random.py", line 885, in <module>
_inst = Random()
File "/usr/lib/python2.7/random.py", line 97, in __init__
self.seed(x)
File "/usr/lib/python2.7/random.py", line 113, in seed
a = long(_hexlify(_urandom(2500)), 16)
OSError: [Errno 38] Function not implemented

--------
Trying this on a cubox-i running 3.14.79-1-ARCH (needed for kodi)
Doing the same on an x86 rig also running arch has no issue
Also imports random OK with python3
grahams
 
Posts: 6
Joined: Tue Mar 16, 2010 4:41 am

Re: python2 import random throws OSError: [Errno 38] Functio

Postby WarheadsSE » Fri May 05, 2017 9:00 pm

Your problem is likely `_urandom` itself, which is probably not present in the 3.14 kernel's syscall table.
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: python2 import random throws OSError: [Errno 38] Functio

Postby grahams » Sat May 06, 2017 4:38 am

Downgrading to python2-2.7.13-1 solves the issue.

Maybe due to the ancient kernel for cubox-i (if we need graphics support)
grahams
 
Posts: 6
Joined: Tue Mar 16, 2010 4:41 am

Re: python2 import random throws OSError: [Errno 38] Functio

Postby rcf » Fri May 12, 2017 5:14 pm

$this->bbcode_second_pass_quote('WarheadsSE', 'Y')our problem is likely `_urandom` itself, which is probably not present in the 3.14 kernel's syscall table.


https://github.com/python/cpython/commi ... 868537901c activates the alternate /dev/urandom code path on Linux to preserve os.urandom()'s non-blocking behavior, solving the problem with getentropy() on older kernels as a side effect.
rcf
 
Posts: 3
Joined: Sat May 06, 2017 8:47 pm

Re: python2 import random throws OSError: [Errno 38] Functio

Postby frol » Mon Jul 03, 2017 8:27 pm

Downgrade to 2.7.13-1 made things only worse, so I had to dig into the issue since Kodi still doesn't support Python 3 (which works just fine on my system). The workaround turned out to be a manual replacement of `/usr/lib/libpython2.7.so.1.0` from the python2-2.7.13-1 package. This worked for me, so I figured I would share it.

P.S. I have downloaded the 2.7.13-1 package from one of the mirrors: https://fraggod.net/static/mirror/packa ... pkg.tar.xz
frol
 
Posts: 4
Joined: Mon Oct 24, 2016 10:40 am


Return to Arch Linux ARM

Who is online

Users browsing this forum: No registered users and 4 guests