LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI works in development, but not as executable--file reading issue.

Hello all.  This problem is similar to others, but has a slight caveat.  We have a VI that we designed to read a .csv file (written in OpenOffice).  The file contains default
values used to fill in controls and indicators.  The VI works fine in the development PC, but when we make an executable, we run into several problems.  Note that the
executable is ran on a different PC, which only has the Labview runtime engines.  The issues we have are listed below:

1.  The executable opens and immediately opens a dialog box asking for a file.  It should find the file instead of asking for it.  We have the path for the file in the
program.


2.  Even if we choose the file for the program to use, then it enters wrong values in the controls and indicators.  Most controls and indicators have 0 values, while others
have different parts of the file that should not even be read.

The vi is attached.  The main problem is in the sequence frame.  You will see that we have three path constants. The top constant is the path for the PC that runs the executable.
The second constant that has the Z path is the one we want to use.  This path allows the program to read a file over the network.  The last constant is the one we currently
use that lets the program read from the PC it is on.


We have checked for misspellings, but we do not see anything, so we can not understand why the executable is asking for a file name, nor why when we choose the file for it to
read it fills in the front panel incorrectly.

As a third issue, if we stop the program, it asks for a file to write to, which it also should not do since it should have the file name and path already.

 

The vi and file are attached.  Thanks for any and all help.

0 Kudos
Message 1 of 15
(4,142 Views)

Your VI has a path constant hardwired in it for C:\Users\testlab\Desktop\LabVIEW Projects\Contactor Life Test State Machine\Contactor Life Test Defaults.csv

 

Does the file exist in that directory?

 

But what I noticed is that the name of the file you attached has an extra .csv extension on it so it is called Contactor Life Test Defaults.csv.csv    Could that be the problem?

 

Your CSV file has two file paths in it.      C:\Users\testlab\Desktop\LabVIEW Projects\Contactor Life Test State Machine\Contactor Cycles.csv and     C:\Users\testlab\Desktop\LabVIEW Projects\Contactor Life Test State Machine\Contactor Current.csv, though it looks like you only use the first one in your  code.  Does that file exist in that directory?

 

The other possibility, though I'm not sure if it applies here, is that when referring to a VI by name, its file path within an executable is different than its file path within the development environment.  So  c:\my project\mysub.vi becomes know as myEXE.exe\mysub.VI.  That shouldn't apply to a CSV file since you shouldn't have that buried within an .exe.  But I do see your file path is c:.....Contactor Life Test State Machine\  and your VI is also called "Contactor Life Test State Machine".   Is your exe called Contactor Life Test State Machine.exe ?   Is Contactor Life Test State Machine an exe path or a subdirectory?  I'm wondering if there is confusion there.

0 Kudos
Message 2 of 15
(4,114 Views)

The files does exist in the directory.  We have the as part of the project and it is in the same folder with the other .csv files the program uses.

 

The .csv extension seems to be an issue.  We need to have that extension for our programs to work, yet at other times it seems we do not need it.  We always save those spreadsheet files as .csv.  When we use the file names in Labview, we have received errors if we do not put .csv on the file name in the path.

 

I have heard about the situation that referring to a VI by name in an executable adds the executable as part of the path.  Using your example, I wouldn't know where to put the 'myEXE.exe' part in the path.  Would it be right before the file name, or right after the drive letter?

 

In answer to the remaining part of your question, the exe is indeed called Contactor Life Test State Machine, which sits on the desktop.  We have a folder called Contactor Life Test State Machine which contains all the files of the build--we took the exe out and put it on the desktop for easy access.

0 Kudos
Message 3 of 15
(4,098 Views)

Take a look at this link  http://digital.ni.com/public.nsf/allkb/FD7DE8BC8FFC256C862565F4006BE363  You'd put the myexe.exe part right before the VI name, after the lowest subdirectory.

 

There is nothing wrong with having the .csv extension.  But in the file you have uploaded, it is in there twice.  But you are only calling a file with one extension.

 

So if your file is named Myfile.txt.txt  but you trying to call Myfile.txt, you won't find it because they are two different filenames.

 

 

0 Kudos
Message 4 of 15
(4,086 Views)

I tried the link but I am getting the following error

 

Error


HTTP Web Server: Lotus Notes Exception - Entry not found in index

0 Kudos
Message 5 of 15
(4,083 Views)

One of the problems with copying and pasting links from other locations is that they sometimes sneak in hidden characters that break the link.

 

Try this one.

 

http://digital.ni.com/public.nsf/allkb/FD7DE8BC8FFC256C862565F4006BE363

0 Kudos
Message 6 of 15
(4,078 Views)

Thank you for the link.  Looking at this, let me ask a question.  The issue of the executable being in the path has never been an issue before.

 

The programs we usually run as executables pull from a .csv file that has two columns, one column is a text description, the second column has numerical values.  The file is located on a network drive.  Our executable program takes the second column and makes cycle counts using that column.  We hardwire the path for the Read Delimited Spreadsheet VI as a constant like you see in the VI that is shown in this thread.    This works for us.

 

The VI in this thread works this way too.  The part of the VI in the sequence frame is a new method we are trying to use to allow us to make default values readable from a file in case we have to change these default values.  This way we would not have to redo an executable just to change some default control/indicator values.

 

Why would the executable being in the path be causing a problem now, when it never has before?

0 Kudos
Message 7 of 15
(4,035 Views)

Hi DHouston, 

That's a great question -- I am not sure why the executable path would not work if you have the same file path on your target computer. There are some workarounds, including using the 'Application Directory' function as mention in the earlier mention documentation.

 

You might also look at the workaround mentioned in this forum. The suggest putting the VIs handling paths into a LLB.

https://forums.ni.com/t5/LabVIEW/Build-exe-and-file-path/td-p/984137 

 

Erika
Technical Support Engineer
National Instruments
0 Kudos
Message 8 of 15
(4,020 Views)

Alas, ErikaB.  I got an error when clicking on that link.  The error is stated below

 

An invalid set of parameters has been specified in the url.

0 Kudos
Message 9 of 15
(4,010 Views)

@Dhouston wrote:

Alas, ErikaB.  I got an error when clicking on that link.  The error is stated below

 

An invalid set of parameters has been specified in the url.


Why does it think it is an url?

The Z: drive seems like a network drive that has been locally mounted to a drive letter.

 

Does the built application have firewall permissions to access the network? (I assume you allowed LabVIEW to access the network when you installed, but that rule no longer applies once you built an executable).

0 Kudos
Message 10 of 15
(4,005 Views)