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: 

error 7 open file+.vi when opening multiple csv files

 
 
Hi,
I it was interesting (and frustrating) that I, intermitantly, got the open file error #7 when I was sitting in a loop opening csv files using ReadFromSpreadsheet file.vi.  The ReadFromSpreadsheetFile.vi is a higher level vi which should open the file, read the number of specified lines, then close the file afterwards.  IT reads the csv files correctly for one iteration of the outside loop (reads one line from 45 .csv files) then it gives the open file error the second time I try to read them.  Perhaps the file is not being closed correctly on the first iteration?  This only happens about half the time, and always on the second iteration.
 
LV 7.1
WIN 2000
 
Any Help is much apreciated.
Greg
 
Greg Hahn
Engineering Intern
Digalog Systems Inc.
New Berlin, WI
0 Kudos
Message 1 of 2
(2,802 Views)

Hello Greg,

Error 7 indicates the file could not be found - are you moving or deleting files somewhere in your sequence? It's actually better to use dataflow to control your "sequence" of events than to use a sequence structure. It looks like you are building your paths programmatically as well, so that could be part of the problem... you could be building a path to a file which doesn't always exist! I would suggest setting some breakpoints and probes, so you can check your file system against the file paths you're building in your code at strategic times and places. This way hopefully you'll find that the file you're trying to access doesn't exist at the time you're trying to access it - after that it's just a matter of tidying up the logic a bit to make sure that doesn't happen. If you find that file does exist, and you think this is a bug, try to filter out all the unnecessary code so that you have something very simple, and I'll try to reproduce it!

Regards,

AG

0 Kudos
Message 2 of 2
(2,773 Views)