Error in random module, bad installation?

A

Andrew F

I'm a linux user and I just upgraded from 2.1 to 2.5 and changed the
location of a number of libraries and tools.

So far I've tracked most errors, but this one has me scratching my
head :

$ which python
/usr/local/bin/python
$ echo $PYTHONPATH
/usr/local/bin/python
$ python
Python 2.5.1 (r251:54863, Sep 5 2007, 09:48:37)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.Unexpected error: <type 'exceptions.TypeError'>
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "random.py", line 10, in <module>
x = random.random()
TypeError: 'module' object is not callable
$ find /usr/local/ -name random.py
../lib/python2.5/random.py
../lib/python2.3/random.py

Do I need to clobber 2.3? ( If so, why???)

TIA

-- Andrew
 
C

Carsten Haese

Unexpected error: <type 'exceptions.TypeError'>
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "random.py", line 10, in <module>
x = random.random()
TypeError: 'module' object is not callable

You have a file called random.py in your current directory. It's
shadowing the random module from the library.

HTH,
 
T

Tim Roberts

Andrew F said:
I'm a linux user and I just upgraded from 2.1 to 2.5 and changed the
location of a number of libraries and tools.

So far I've tracked most errors, but this one has me scratching my
head :

$ which python
/usr/local/bin/python
$ echo $PYTHONPATH
/usr/local/bin/python

PYTHONPATH is supposed to point to the directory containing modules, NOT
the directory containing the executable. It should be /lib/python2.5.

However, Carsten had the real cause for your immediate problem.
 
A

Andrew F

PYTHONPATH is supposed to point to the directory containing modules, NOT
the directory containing the executable. It should be /lib/python2.5.

Thank you both -- it was a combination of the problems.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top