-1

I have built some useful Python functions inside a .py file. I use this function through LabView calling it by a Python node and pass arguments to it (images as array). The calling to Python functions is transparent and no console is opened at runtime. Now I need to debug the Python code so I need the Python console to open and wait for user interaction in a step by step mode.

Labview version is 2018 and Python is 3.7. I have made some tries using the subprocess module but I can't run the functions defined in my Python script.

def test():
    print("provaprova")
    return 0;

def debug_Command():
    subprocess.call("test", shell=True)
    return 0;
double-beep
  • 5,031
  • 17
  • 33
  • 41
  • 1
    you can call pythonw in Windows, to open console, I suppose. – RandomB Jun 25 '19 at 07:37
  • What is it that needs debugging? Are you happy that LabVIEW is calling the Python function and passing the arguments in OK, or is that where the problem is? – nekomatic Jun 25 '19 at 08:04
  • The problem is to pass the arguments. Like i said that was images, in labview imaq format, so i need to convert it to array (RGB, 3 array) and i don't know how to pass it if not programmatically. The problem is in the python code. – F. Matassoni Jun 25 '19 at 08:05
  • 1
    Well, it sounds as if your real question is *'how do I pass IMAQ images from LabVIEW into a Python script?'*. What about calling a temporary stub script that just saves the data from LabVIEW to a file using `pickle.dump`? Then you can `load` it in an interactive Python session and try out different ways of reading it. – nekomatic Jun 26 '19 at 10:06
  • This is a good idea! I will make a try. – F. Matassoni Jun 27 '19 at 12:35
  • You could try using TestScript: https://www.winemantech.com/testscript-download. – Adrian Keister Nov 25 '19 at 20:44

1 Answers1

0

Maybe you can run the python with your script and interactive mode:

The content of script:

$ cat test.py 
def test():
    print('Hello world')

And you can load the script and enter in interactive mode with -i :

$ python3 -i test.py
>>> test()
Hello world
>>> 
tres.14159
  • 850
  • 1
  • 16
  • 26