error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Guest's Avatar

    #1

    error



    Hi,

    Today is my first day of working on python. I want to execute python
    script through C++ program. I found one very good article with example
    at http://docs.python.org/ext/pure-embedding.html.
    I followed the procedure as given, the code is compiled but while
    running it is giving error like:
    ImportError: No module named multiply
    Failed to load "multiply"

    Here are the steps I followed, please suggest where I am wrong and how
    can I remove the above error.

    Step 1: Copied the given C program into a file called test.cpp (using vi
    editor)
    Step 2: Compiled it using : g++ test.cpp /usr/lib/libpython2.4.so
    (created a.out)
    Step 3: Wrote the given script of multipication in a file named as
    multiply (using vi editor)
    Step 4: But while running the program using : ./a.out multiply
    multiply 3 2
    Getting this error: ImportError: No
    module named multiply
    Failed to
    load "multiply"

    Please help me out.

    Thanks & Regards,
    Prashant Burghate
    Project Engineer,
    Embedded Systems,
    Wipro Technologies, Pune.
    Tel: +91-20-22933700 Extn: 51570
    Mob. # 9850428252
    Email: prashant.burgha te@wipro.com


    The information contained in this electronic message and any attachments tothis message are intended for the exclusive use of the addressee(s) andmay contain proprietary, confidential or privileged information. If youare not the intended recipient, you should not disseminate, distribute orcopy this e-mail. Please notify the sender immediately and destroy allcopies of this message and any attachments.

    WARNING: Computer viruses can be transmitted via email. The recipientshould check this email and any attachments for the presence of viruses.The company accepts no liability for any damage caused by any virustransmitte d by this email.

    As a global leader, Wipro blends consulting and AI expertise across design, engineering and operations to accelerate business transformation and deliver future-ready technology.

  • Rob Wolfe

    #2
    Re: error


    prashant.burgha te@wipro.com wrote:
    Hi,
    [...]
    Step 3: Wrote the given script of multipication in a file named as
    multiply (using vi editor)
    The name of module should be multiply.py

    HTH,
    Rob

    Comment

    • John Machin

      #3
      Re: error


      prashant.burgha te@wipro.com wrote:
      Hi,
      >
      Today is my first day of working on python. I want to execute python
      script through C++ program. I found one very good article with example
      at http://docs.python.org/ext/pure-embedding.html.
      I followed the procedure as given, the code is compiled but while
      running it is giving error like:
      ImportError: No module named multiply
      Failed to load "multiply"
      >
      Here are the steps I followed, please suggest where I am wrong and how
      can I remove the above error.
      >
      Step 1: Copied the given C program into a file called test.cpp (using vi
      editor)
      Step 2: Compiled it using : g++ test.cpp /usr/lib/libpython2.4.so
      (created a.out)
      Step 3: Wrote the given script of multipication in a file named as
      multiply (using vi editor)
      Try naming your source file multiply.py but continue to use the module
      name (multiply) in the command line. [Note: you could have a binary
      extension module called multiply in a binary file called multiply.so]

      I guess the author of that manual section didn't contemplate somebody
      on their first day with Python doing some embedding :-)

      HTH,
      John

      Comment

      • John Machin

        #4
        Re: error


        Rob Wolfe wrote:
        prashant.burgha te@wipro.com wrote:
        Hi,
        [...]
        Step 3: Wrote the given script of multipication in a file named as
        multiply (using vi editor)
        >
        The name of module should be multiply.py
        >
        module != source_file
        module don't have no ferschlugginer dots in its name

        Comment

        • Rob Wolfe

          #5
          Re: error


          John Machin wrote:
          Rob Wolfe wrote:
          prashant.burgha te@wipro.com wrote:
          Hi,
          [...]
          Step 3: Wrote the given script of multipication in a file named as
          multiply (using vi editor)
          The name of module should be multiply.py
          >
          module != source_file
          module don't have no ferschlugginer dots in its name
          Ooops... sorry.
          I meant name of python source file, of course.

          Regards,
          Rob

          Comment

          Working...