No math module??

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • WIdgeteye

    #1

    No math module??


    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.p y", 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


  • Ben Finney

    #2
    Re: No math module??

    WIdgeteye <None@none.none > writes:
    [color=blue]
    > 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.[/color]

    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.[color=blue][color=green][color=darkred]
    >>> import math
    >>> repr(math)[/color][/color][/color]
    "<module 'math' from '/usr/lib/python2.3/lib-dynload/math.so'>"[color=blue][color=green][color=darkred]
    >>>[/color][/color][/color]

    $ 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.

    --
    \ "My doctor told me to stop having intimate dinners for four. |
    `\ Unless there are three other people." -- Orson Welles |
    _o__) |
    Ben Finney

    Comment

    • WIdgeteye

      #3
      Re: No math module??

      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.


      [color=blue]
      > WIdgeteye <None@none.none > writes:[/color]
      [color=blue][color=green]
      >> [quoted text muted][/color]
      >
      > 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.[color=green]
      >> [quoted text muted][/color]
      > "<module 'math' from '/usr/lib/python2.3/lib-dynload/math.so'>"[color=green]
      >> [quoted text muted][/color]
      > $ 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.[/color]

      Comment

      • Serge Orlov

        #4
        Re: No math module??

        WIdgeteye wrote:[color=blue]
        > 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 ?[/color]

        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.
        [color=blue]
        > 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.p y", line 25, in ?
        > import BZcommon
        > File "/home/Larry/.blender/scripts/bzflag/BZcommon.py", line 24, in ?
        > import math
        > ImportError: No module named math
        >[/color]

        [snip]
        [color=blue]
        > So what's up?? :)[/color]

        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.

        Comment

        • Tim Roberts

          #5
          Re: No math module??

          WIdgeteye <None@none.none > wrote:[color=blue]
          >
          >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.[/color]

          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".
          --
          - Tim Roberts, timr@probo.com
          Providenza & Boekelheide, Inc.

          Comment

          • Tim Golden

            #6
            Re: No math module??

            Tim Roberts wrote:[color=blue]
            > WIdgeteye <None@none.none > wrote:[color=green]
            > >
            > >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.[/color]
            >
            > 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.[/color]

            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

            Comment

            Working...