From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Newbie App Developer - EXE does not write to disk

Solved!
Go to solution

I am running LabVIEW 14 on a Windows 7 box here in my office.  I develop and test here, then build an EXE and deploy that EXE to a remote Win7 PC via TeamViewer.  It has worked for a number of intermediate VIs that do not involve writing to disk.  The latest EXE works exactly like I want it to work on my local box, but when I deploy it to the remote box...

 

...it seems to have trouble creating the output file that is generated by the "Write Spreadsheet File" subVI.  To emphasize:  it works on my local PC.

 

I have assumed the problem is a permissions issue, so after trying a number of different paths, both hard-coded into the VI as a PATH variable and generated dynamically by a PATH dialog box, I have hard-coded the path as

 

C:\Users\Public\

 

and have changed the permissions on that folder to the most "permissive" possible.

 

Now, the VI successfully generates the next daughter folder, e. g.,

 

C:\Users\Public\20140902144410\

 

in which the folder name is simply the YYYYMMDDhhmmss of the current time stamp at VI execution.  Every time the VI runs, I want it to create this unique folder and put the multiple spreadsheet files in it.  THAT FOLDER APPEARS, but no files are created inside it.  While troubleshooting, I created an indicator to show the initial output path that is created during the startup phase of the VI, and it returns the correct value as shown in the attached JPG screen shot.  Again, the folder successfully appears in the right place in the directory structure.

 

Am I wrong to suppose that the likely problem here is a permissions issue?

 

Thanks for any help...and solutions!

 

Brent Auvermann

Professor of Agricultural Engineering, TAMU

0 Kudos
Message 1 of 6
(2,822 Views)

Have you checked if there's any error from writing to the spreadsheet file? Appropriate use of the Simple (or General) Error Handler might help here, since it will pop up a dialog box with any error text.

 

Have you tried a simple executable that does nothing but write to a file in that folder? Does that work?

 

Can you share your code? Is there any possibility you're trying to create the file, before the folder is created?

0 Kudos
Message 2 of 6
(2,789 Views)

If Labview does not write as expected you are bound to get an error from the error cluster. you may want to look into that. If you have an issue with it you can share the error clusters value or the VI you use to write your data.

 

Hope that helped 🙂

Derick Mathew
0 Kudos
Message 3 of 6
(2,763 Views)

First, thanks to both of you for your attention to this.

 

The code is, at least for me, pretty darn big, so I've extracted that portion of it that pertains to the path construction, folder creation, and opening/writing/closing (streaming to disk, essentially).  There's really not much to it, as you will see in the attachments (JPG and .vi).

 

For context, the full VI is designed to read 48 serial devices simultaneously, two each on 24 different masts affixed at different heights to towers at various locations.  The code separates them by tower and mast and writes the data to disk with filenames pointing to the tower and mast from which the data were measured.  So the code shown in the attachment is replicated many times for different towers and for different masts on each tower.

 

One last thing.  The code works fabulously on my local PC.  When the folder needed does not exist (which is every time the VI runs, essentially, since the code generates a new path based on the time stamp at code inception), the VI creates the folder, and the data are streamed to disk wonderfully.  So the fundamental structure is working.  It's just that when it is compiled to an EXE and deployed to another PC, the output files don't get created.

 

Again, thank you so much for your attention and suggestions.  I guess I need to spend some time learning how to use the error handlers.

 

Brent

Download All
0 Kudos
Message 4 of 6
(2,726 Views)

When you run the code on your local PC, are you running it in the development environment, or as a compiled EXE?

 

As I previously suggested, put a Simple Error Handler after Close File, set it to pop up a dialog on error, and see if an error occurs. If an error is reported there, that information will make it enormously easier to help you. Conversely, if no error occurs, then it's possible the source is something else entirely - maybe that entire VI isn't being executed in the EXE for some reason? Enable remote debugging, and see if that VI is executing.

0 Kudos
Message 5 of 6
(2,713 Views)
Solution
Accepted by topic author queue_ball

NathanD, I just verified that the code works on my local PC whether I run it in the development environment or as an EXE.  I've also discovered, alas, that several different programs on the remote PC are having trouble establishing connections with the virtual COM ports through which my serial instruments are accessed.  Given that my LabVIEW code doesn't attempt to read a COM port even the first time unless there are bytes>0 at that port, and the output files only get created once the first data stream is read from a COM port, that must be the problem, and not something with my LabVIEW code after all.

 

Again, thanks to both of you.

0 Kudos
Message 6 of 6
(2,652 Views)