LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

File creation issue with Labview

Solved!
Go to solution

Hi all.

 

Running a new compiled version of my program (LV 2016) which appearred to be fine in testing.

 

However today it display these errors

Greg1956_0-1584423384299.png

this occurred at the write phase of the run followed by

Greg1956_1-1584423424015.png

 

This seems to indicate an issue with Windows 10 security. I have updated C drive security access to allow the application full rights (read/write etc).

 

I've also added the whole project so if the issue is mine please let me know.

 

0 Kudos
Message 1 of 12
(2,447 Views)

Hi Greg,

 

there are file permission errors: the first check would be to make sure the file path you try to write to is correct!

 

Did you probe the file path?

 

You really should improve that program to use less global/local variables, more shift registers in your statemachine, avoid race conditions (like in ValveCntrlData), organize all VIs into the project, …

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 12
(2,422 Views)

(I agree with the comment about all the glaring race conditions due blatant local variable overuse. Also watch out for terminology. LabVIEW is always "compiled" even if you run your code inside the development system. I assume you probably mean "built as executable".)

 

You specific problem is the following code:

 

altenbach_0-1584428888747.png

 

Start reading here.

 

0 Kudos
Message 3 of 12
(2,412 Views)

thanks Gird,

 

Not sure what probing the file path means.

The directory does exist on the C drive at "C:\Valve_Controller_v4\Result".

 

I'm assuming that it has been written with variables and is pointing somewhere else.

 

I will dig deeper as in the following email and see what it means.

 

thanks

Greg

0 Kudos
Message 4 of 12
(2,365 Views)

thanks Knight,

 

makes sense, yes it is an executable.

 

Can't find anything as you have displayed "Data" but this

Greg1956_0-1584482876410.png

"Logfilepath", how can I read it or set it as a constant eg "C:\valve_controller_v4\results" just to get things running.

 

My main issue is I work 3 days a week, and have no formal coding training in this software and am unlikely to get any training.

So I'm flying blind.

 

All the comments about structural issues are correct but I can't fix them.

 

sorry a little stressed.

 

Greg

 

 

0 Kudos
Message 5 of 12
(2,361 Views)

A probe is a basic troubleshooting technique in LabVIEW.  Right click the wire that contains your path and select "probe".  A window will appear that will show you its actual value during execution.

 

As the others have said, its a file permission error; here are a few options.

1) the file path is incorrect ( a probe helps check this here)

2) your trying to create a new file but you have "open" wired to the "operation" terminal of the open/create/replace file vi

          This requires that it already exists.  right-click the "operation" terminal and choose create constant.  you'll get an enum constant that you can change to "create/replace"

3) "C:\Valve_Controller_v4\Result" is a folder path, not a file so make sure you are including a file extension like .txt or .csv

0 Kudos
Message 6 of 12
(2,359 Views)

Hi,

 

As the others have said, its a file permission error; here are a few options.

1) the file path is incorrect - understand this ( a probe helps check this here) don't understand this comment

 

2) your trying to create a new file but you have "open" wired to the "operation" terminal of the open/create/replace file vi

    This requires that it already exists.  right-click the "operation" terminal and choose create constant.  you'll get an enum constant that you can change to "create/replace"

Sorry don't understand your comment

3) "C:\Valve_Controller_v4\Result" is a folder path, not a file so make sure you are including a file extension like .txt or .csv

Yes I was hoping just to set the folder path to that

 

 

When you set it running, it asks you to name the storage data file which we do.

But once it gets to the end of the first data write it pops back up requesting a file name, and each subsequent data write does the same. At no stage does it appears to write a data file in any folder.

 

hope that helps

 

Greg

0 Kudos
Message 7 of 12
(2,356 Views)

@Greg1956 wrote:

 

Can't find anything as you have displayed "Data" but this

 

"Logfilepath", how can I read it or set it as a constant eg "C:\valve_controller_v4\results" just to get things running.

 


 

 

As my link clearly explains, you need to strip once or twice, based on the execution environment (exe or dev env.) or use the one of the other listed workarounds.

 

Did you read my link above? You log file is based on the current VI path, which changes once it is inside the excutable.

 

 

Look in the main program, case "1". There is a subVI called V_C_log_initialize, this sets the global variable for the log file path to:

 

"<current VI path location (i.e. vi path stripped of the VI name)>/data"

 

Once it's inside the executable, the VI path is "... xxx/application.exe/vi name" and after stripping the name, you are trying to create a path as "...xxx/application.exe/data", which is of course nonsense. you cannot build a folder inside or after the exe!

 

Also, please give your data file an extension (e.g. call it "data.dat" or whatever). It's less likely to collide with a folder name (Often, there is a "data" folder next to the executable!)

 

 

 

Message 8 of 12
(2,346 Views)
Solution
Accepted by topic author Greg1956

Also note that you have a potential race condition because you cannot guarantee that the global variable is written before it is read inside the subVI below.

 

 

altenbach_0-1584489102813.png

 

Message 9 of 12
(2,344 Views)

thanks.

 

I have worked out how to set the default install folder on my Win10 PC.

 

It appears that the Universities security policy was the cause of the issue. It would not let me write any data to the C:\program data  and C:\program data (x86) folders.

The security was set to Read only and the policy prevented the application from writing results to the folder.

 

Once I swapped to a specific folder (c:\valve_controller_v4) it was all good again.

 

thanks for your help, learnt more things today.

 

Greg

Message 10 of 12
(2,335 Views)