embedding python

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Anand K Rayudu

    embedding python

    Hi All,

    I have one problem with embedding python into my application.
    on HP-UX11 i created my application with linking libPython2.3.a
    And with my product i supply all extension dlls [ .so] and with
    appropriate PYTHONHOME and PYTHONPATH set.

    Every thing is fine till i import math,
    When i import math [ For all extension modules ]
    I get following error.
    import math
    ImportError: dynamic module does not define init function (initmath)

    But if i run python in shell it works fine,
    I am sure it is some thing to do with my application linking or some
    thing like that.
    Could some one please suggest, how to solve this problem.

    It works fine on all other platforms.
    I call python using 'PyRunSimpleFil e' Function.

    Thanks in advance.

    Anand



  • William Park

    #2
    Re: embedding python

    Anand K Rayudu <anand@easi.sof t.net> wrote:[color=blue]
    > Hi All,
    >
    > I have one problem with embedding python into my application.
    > on HP-UX11 i created my application with linking libPython2.3.a
    > And with my product i supply all extension dlls [ .so] and with
    > appropriate PYTHONHOME and PYTHONPATH set.
    >
    > Every thing is fine till i import math,
    > When i import math [ For all extension modules ]
    > I get following error.
    > import math
    > ImportError: dynamic module does not define init function (initmath)
    >
    > But if i run python in shell it works fine,
    > I am sure it is some thing to do with my application linking or some
    > thing like that.
    > Could some one please suggest, how to solve this problem.
    >
    > It works fine on all other platforms.
    > I call python using 'PyRunSimpleFil e' Function.
    >
    > Thanks in advance.
    >
    > Anand[/color]

    Did you compile with '-lm' ?
    Eg:


    --
    William Park, Open Geometry Consulting, <opengeometry@y ahoo.ca>
    Linux solution for data management and processing.

    Comment

    • Anand K Rayudu

      #3
      Re: embedding python



      William Park wrote:
      [color=blue]
      >Anand K Rayudu <anand@easi.sof t.net> wrote:
      >
      >[color=green]
      >>Hi All,
      >>
      >>I have one problem with embedding python into my application.
      >>on HP-UX11 i created my application with linking libPython2.3.a
      >>And with my product i supply all extension dlls [ .so] and with
      >>appropriate PYTHONHOME and PYTHONPATH set.
      >>
      >>Every thing is fine till i import math,
      >>When i import math [ For all extension modules ]
      >> I get following error.
      >> import math
      >>ImportError : dynamic module does not define init function (initmath)
      >>
      >>But if i run python in shell it works fine,
      >>I am sure it is some thing to do with my application linking or some
      >>thing like that.
      >>Could some one please suggest, how to solve this problem.
      >>
      >>It works fine on all other platforms.
      >>I call python using 'PyRunSimpleFil e' Function.
      >>
      >>Thanks in advance.
      >>
      >>Anand
      >>
      >>[/color]
      >
      >Did you compile with '-lm' ?
      >Eg:
      > http://home.eol.ca/~parkw/index.html
      >Hi William,
      >[/color]

      Thanks for the help, I compiled with -lm , It did not work!!
      Probably i need to re-compile python with -DEMBED_PYTHON option as you
      suggested.
      As the python error suggests, it could load the dynamic library, but
      could not find 'initmath' symbol in the library.
      looks like '_PyImport_GetD ynLoadFunc' function is failing.
      And i also see following define. I am hoping this gives some info to
      solve the issue.

      #if defined(__hp900 0s300)
      #define FUNCNAME_PATTER N "_init%.200 s"
      #else
      #define FUNCNAME_PATTER N "init%.200s "
      #endif




      [color=blue]
      >
      >[/color]


      Comment

      • William Park

        #4
        Re: embedding python

        Anand K Rayudu <anand@easi.sof t.net> wrote:[color=blue][color=green]
        > >Did you compile with '-lm' ?
        > >Eg:
        > > http://home.eol.ca/~parkw/index.html[/color]
        >
        > Thanks for the help, I compiled with -lm , It did not work!!
        > Probably i need to re-compile python with -DEMBED_PYTHON option as you
        > suggested.[/color]

        No. '-DEMBED_PYTHON' is just for my patch, which embeds Python in Bash
        shell. It's one example of embedding and compiling. Since I can do
        math, there must be something I'm doing that you're not. :-)

        --
        William Park, Open Geometry Consulting, <opengeometry@y ahoo.ca>
        Linux solution for data management and processing.

        Comment

        • Anand K Rayudu

          #5
          Re: embedding python

          [color=blue]
          >
          >[color=green][color=darkred]
          >>>Did you compile with '-lm' ?
          >>>Eg:
          >>> http://home.eol.ca/~parkw/index.html
          >>>
          >>>[/color]
          >>Thanks for the help, I compiled with -lm , It did not work!!
          >>Probably i need to re-compile python with -DEMBED_PYTHON option as you
          >>suggested.
          >>
          >>[/color]
          >
          >No. '-DEMBED_PYTHON' is just for my patch, which embeds Python in Bash
          >shell. It's one example of embedding and compiling. Since I can do
          >math, there must be something I'm doing that you're not. :-)
          >[/color]
          Yes I figured it out, are u also trying on HP machines? Bacause it works
          fine on all other platforms!!!
          [color=blue]
          >
          >
          >[/color]


          Comment

          Working...