No math module??

W

WIdgeteye

I have been trying to run a python program and I get the following
error:
Traceback (most recent call last):
File "<string>", line 39, in ?
File "/home/Larry/.blender/scripts/bzflag/__init__.py", line 22, in ?
import BZfileRead
File "/home/Larry/.blender/scripts/bzflag/BZfileRead.py", line 24, in ?
import BZsceneWriter
File "/home/Larry/.blender/scripts/bzflag/BZsceneWriter.py", line 25, in ?
import BZcommon
File "/home/Larry/.blender/scripts/bzflag/BZcommon.py", line 24, in ?
import math
ImportError: No module named math

So just to check and make sure I tried to import the math module
and sure enough there isn't one. This whole program has calls to
the "math" module all the way through it.

I have been using python on my computer since it first came out and
this is the first time I have runinto this. I have Python 2.3.2
installed on Slackware Linux. I installed it from source download
from the Python.org web site.

I have looked all over for a math module but can't find one.
Maybe not looking in the right place???

So what's up?? :)

thanks
 
B

Ben Finney

WIdgeteye said:
ImportError: No module named math
[...]
I have been using python on my computer since it first came out and
this is the first time I have runinto this. I have Python 2.3.2
installed on Slackware Linux. I installed it from source download
from the Python.org web site.

It definitely should be part of the default Python install. On my
Debian system:

=====
$ python
Python 2.3.5 (#2, Sep 4 2005, 22:01:42)
[GCC 3.3.5 (Debian 1:3.3.5-13)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
$ dpkg -S /usr/lib/python2.3/lib-dynload/math.so
python2.3: /usr/lib/python2.3/lib-dynload/math.so
=====

Perhaps you should use the official Python package for your operating
system, or double-check you built and installed the source packages
the way you want them.
 
W

WIdgeteye

On Tue, 23 May 2006 12:40:49 +1000, Ben Finney wrote:

Ok this is weird. I checked:
/usr/local/lib/python2.3/lib-dynload/math.so

Just as you have on your system and it's there.
So why in the heck isn't it loading with:
import math ????

This is strange.


[quoted text muted]

It definitely should be part of the default Python install. On my Debian
system:

=====
$ python
Python 2.3.5 (#2, Sep 4 2005, 22:01:42) [GCC 3.3.5 (Debian 1:3.3.5-13)]
on linux2 Type "help", "copyright", "credits" or "license" for more
information.
[quoted text muted]
[quoted text muted]
$ dpkg -S /usr/lib/python2.3/lib-dynload/math.so python2.3:
/usr/lib/python2.3/lib-dynload/math.so =====

Perhaps you should use the official Python package for your operating
system, or double-check you built and installed the source packages the
way you want them.
 
S

Serge Orlov

WIdgeteye said:
I have been trying to run a python program and I get the following
error:
Traceback (most recent call last):
Fil e "<string>", line 39, in ?

That doesn't look like a python program, File "<string>" means it's an
embedded script. When a script is embedded it is responsibility of the
caller (blender application) to setup correct path to modules.
File "/home/Larry/.blender/scripts/bzflag/__init__.py", line 22, in ?
import BZfileRead
File "/home/Larry/.blender/scripts/bzflag/BZfileRead.py", line 24, in ?
import BZsceneWriter
File "/home/Larry/.blender/scripts/bzflag/BZsceneWriter.py", line 25, in ?
import BZcommon
File "/home/Larry/.blender/scripts/bzflag/BZcommon.py", line 24, in ?
import math
ImportError: No module named math

[snip]

So what's up?? :)

Try to insert
==============
import sys
print sys.path, sys.version, sys.executable
==============
right before the failing "import math". The next step is most likely to
RTFM how to properly setup python embedded into blender. If everything
looks as described in the manual, it's a bug in blender.
 
T

Tim Roberts

WIdgeteye said:
On Tue, 23 May 2006 12:40:49 +1000, Ben Finney wrote:

Ok this is weird. I checked:
/usr/local/lib/python2.3/lib-dynload/math.so

Just as you have on your system and it's there.
So why in the heck isn't it loading with:
import math ????

This is strange.

Is the Python that you are running actually 2.3? Some Linux systems have
both Python 1 and a Python 2 installed. Typing "python" at a command line
often gets Python 1, because the vendor's configuration scripts assume
that.

However, that doesn't answer the question, because even Python 1.5 should
have a module called "math".
 
T

Tim Golden

Tim said:
Is the Python that you are running actually 2.3? Some Linux systems have
both Python 1 and a Python 2 installed. Typing "python" at a command line
often gets Python 1, because the vendor's configuration scripts assume
that.

Maybe he's running a UK-based distro which has
renamed the math module to maths? (I have to work
really hard to remember *not* to put the "s" on the
end when I import it!

;-)

TJG
 

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
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top