0

I need to execute C++ code to acquire images to process in python.

I need to use these commands from python:

  1. make and
  2. ./name_of_the_executable

Could anybody please help know me how to do it?

3
  • 1
    Your question implies these are full executable programs (is that the make utility you wish to run?), in which case they need to be run in another process, see subprocess module in the standard library: docs.python.org/2/library/subprocess.html. How are the images to be passed into python? If you get problems, post what you have tried so far. Commented Jun 20, 2015 at 13:49
  • I am going to periodically read the image file from python code and process it using OpenCV. To have the images in the particular path, I need to run a C++ executable. Can I use something like this? Commented Jun 20, 2015 at 14:03
  • Is the C++ a full executable program, or a DLL/.so? You say 'image file', does the C++ create a file then? Did you look at the subprocess module? Commented Jun 20, 2015 at 15:29

2 Answers 2

2

The standard module os provides the system call that allows execution of arbitrary operating system commands from Python. For example:

import os
os.system('ls -latr');
Sign up to request clarification or add additional context in comments.

Comments

2

Look For python.net which is cable of making a call to the interfaces written in .net supported languages. What all you need to do is

Steps:

  1. Download and put it two files Python.Runtime.dll and clr.pyd in your DLLs folder.

  2. From you >>>(triple greater than prompt )Python prompt Try

    >>>import clr

  3. if it doesn't gives any error you are good to go .

  4. Next You need to do is put Your C++ Dll inside Lib/site-packages Folder .

(This is not mandatory but good for beginners).

  1. Next to import clr try importing your Dll as a module import YourDllName

If step 5 doesn't gives you a error . Hola You are done That's All Folks :)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.