import random error on linux

hello

i just updated my system
also updating python to Python 2.4.2 (#2, Sep 30 2005, 21:19:01)

i get the follow error when i try to run a python script from within blender:
jmcs3@interlichtspielhaus:~$ b
Using Python version 2.4
Traceback (most recent call last):
File “sculpt_023.py”, line 5, in ?
File “/usr/lib/python2.4/random.py”, line 68, in ?
import _random
ImportError: /usr/lib/python2.4/lib-dynload/_random.so: undefined symbol: _PyArg _NoKeywords

is the current blender 2.41 incompatible with python 2.4.2 ?

thanks for any help
jmcs3

Does your python 2.4.2 import random ok just from a shell prompt?

You might check your python path for a old copy of whrandom.py or random.py, I have seen those old copies cause import errors since random is now included in the base level python packages.

yes
, using “import random” in the shell causes no problem

and there seems to be only one of each present on my system
jmcs3@interlichtspielhaus:~$ locate random.py
/usr/lib/python2.4/random.py
/usr/lib/python2.4/whrandom.py
/usr/lib/python2.4/random.pyc
/usr/lib/python2.4/whrandom.pyc
/usr/lib/python2.4/random.pyo
/usr/lib/python2.4/whrandom.pyo

so the problem remains …

thanks
jmcs3

That error seems like it has to be a mismatch between the script random.py and the c library. Do a real find for random.py instead of locate, see if any of the hits show up in your python path as root do:

find / -name “random.py*” -print
find / -name “whrandom.py*” -print

If the script is you are running is in a .blend file does it contain random.py or whrandom.py?

See if plain random works from blender. In the blender text editor enter

import random
print random.random()

Check your python path from with in blender and from the console, do they match?

If all else fails perhaps you could upgrade python from source to make sure you have a clean install.

all the above failed
, so i went for the easy solution and compiled python2.4.3
but that didn’t help either :slight_smile:

anyway my problem is a little bit solved by using a self-compiled version of blender i forgot about ( halfway 2.41 and 2.42 )

the blenderversion causing me trouble is a precompiled dynamic one from blender.org

the mystery remains

but certainly thanks for your time !

kind regards
jmcs3

i have exactly the same problem as above
i use ubuntu edgy with python 2,4.4 c1 and blender 2.43 rc3

if i imiport the random
write this on console:

Traceback (most recent call last):
File “Text.001”, line 1, in ?
File “/usr/lib/python2.4/random.py”, line 67, in ?
import _random
ImportError: /usr/lib/python2.4/lib-dynload/_random.so: undefined symbol: _PyArg_NoKeywords

somebody can hepl solve this problem?

Since blender 2.42a there have been problems with blender, python and linux. The only solution I have found to date is to compile and install python and blender from source. There are several issues on the bug tracker about this that look like it could be fixed in a 2.4x release.

Doing the compile from source is not that difficult, once setup then you can always grab the latest features, kind of makes it worth the extra effort.