LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 1672 Unknown Python error

I'm calling functions from a Python script using a Python node in a malleable VI (attached). I verified that the Python script works as expected outside of LabView. However, when running it from within LabView, I sometimes get an error code 1672 with the message "There was an unknown Python error in the operation."

 

I found almost no information about this error online or within LabView, and I am unable to consistently replicate it. I tried calling it from another VI (within a loop) and letting it run for several hours; sometimes it gives the error after an hour, and sometimes it takes 7 hours to get the error.

 

I can't attach the Python script (proprietary), but it works fine outside of LabView. The behavior of the Python function that produces the error is a series of VISA Write operations.

 

I'm using 32-bit LabView version 18.0.1f4, on Windows 10. The Python interpreter is version 3.6.8.

 

Any advice would be appreciated!

0 Kudos
Message 1 of 11
(6,767 Views)

Perhaps it is trying to access an instrument at the same time LabVIEW is trying to?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 11
(6,744 Views)

Thanks for the reply! Is there a way to check programmatically if the connection is busy?

 

LabView doesn't interact with the instrument apart from calling the Python script, but I'm wondering if it's possible to delay the function call depending on whether the connection is in use.

0 Kudos
Message 3 of 11
(6,695 Views)

I'm no expert at calling Python from LabVIEW, but I'm going to say, "probably not".  Hopefully, someone with more expertise than I can answer definitively.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 11
(6,678 Views)

Any solutions/ known reasoning behind this issue yet?

0 Kudos
Message 5 of 11
(6,304 Views)

I'm also interested in some additional details from NI on this issue.  I have two projects, each capable of running successfully in the development environment (LV 32-bit, Python 3.9.6).  Once each is built to an executable, the Executable generates this same 1672 error, in each case.

 

One of them has been tested on another environment and works fine in both development and executable, so I suspect it has to do with how the Python environment has been set up, but I'm unable to find any variables that matter.

0 Kudos
Message 6 of 11
(6,127 Views)

I would suggest either contacting NI support or creating a new thread for your particular issue as the reason why you are receiving error 1672 is probably quite specific to your situation.

Matt J | National Instruments | CLA
0 Kudos
Message 7 of 11
(6,111 Views)

Hi !

 

I can consistently replicate this error using Python 3.9.13, numpy 1.24.2 and LabVIEW 2021 (all 32bit on Windows10 64bit 21H2) .

 

I am able to run correctly all python provided examples (Labview Help, Find examples) except the NumpyMatmul.vi

 

Any ideas ?

Dimitri

0 Kudos
Message 8 of 11
(5,787 Views)

As a follow-up, we were finally able to trace this down on our end.  The unknown error was eventually traced to incompatibilities within the Python environment.  Unfortunately, there is very little documentation about this, but there are multiple libraries in the Python realm, such as scikit-image, numba, scipy and others, which themselves may call upon or have dependencies with libraries such as numpy.  Here is the response I sent to NI Tech Support, since we had already opened up a support request ticket.  By the way, these issues are relatively "new terrain" for NI, too:

 

"We resolved the 1672 error by setting up an environment within Anaconda, where we made sure we did NOT have overlapping incompatibilities in module dependencies between the following Python add-on modules: numpy, numba, scikit-image, and scipy.  One interesting observation was that these incompatibilities were found to exist ONLY in context of a Python script being called by LabVIEW.  Within the Python interpreter environment (Spyder 5.2.2), the discovered dependencies were COMPATIBLE (the Python script ran and returned results without error).  It was only when calling the same Python script from a Python module in LabVIEW (Python 3.9.13, LabVIEW 2021 SP1, both of them 64-bit) that the error code 1672 occurred!  The solution involves, by trial and error, reverting some of the Python add-on libraries (modules) mentioned above to earlier versions.  Note that doing this ALSO tends to revert some of the additional dependent libraries, installed with these modules, to similarly earlier versions, so it is difficult to discern the exact “culprit” in the Python environment."

 

Understandably, since none of the authors of the individual third-party add-on libraries can anticipate which of their libraries might be used in conjunction with any other libraries, they are not too concerned about compatibility issues.  And especially, as my comments to NI above demonstrate, whether or not these issues only surface in the context of a LabVIEW (and possibly other host languages) call to the Python script.  For now, it pretty much falls upon the LabVIEW developer to figure out incompatibility issues.

 

Below, I've added some other links which may or may not be relevant to your situation, but I have found useful with regard to Python node work in LabVIEW:

 

Solved: Re: Python Node not working on EXE file (works on development computer) - NI Community

 

LabVIEW array of Cluster and Python List of Dictionary | Test Engineers Resource (testengineerresour...

 

Advanced Datatypes with Python Node in LabVIEW (sasworkshops.com)

 

Passing Python Data Structures To/From LabVIEW with the Python Node - NI

 

Solved: Re: Error 1671 Python Node - NI Community

 

Solved: Re: Python Node not working on EXE file (works on development computer) - NI Community

 

LabVIEW 2023 Q1 Bug Fixes - NI (there is a direct reference to the 1672 error and use of Numpy)

Message 9 of 11
(5,776 Views)

Hello mkh_1064,

 

Kudos for this thorough and informative reply 👏👏

0 Kudos
Message 10 of 11
(5,746 Views)