LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 7 - .txt-file opening

Solved!
Go to solution

Hi all,

 

this might be going down as the old chesnut, but i'm wondering what i'm doing wrong. I've build a program over the last 2 years which is all based around opening .txt files and analysing the data around it. This has been working perfectly untill i re-organised my folder structure last week. Since than it comes up with the all so famous error: 'Error 7 occurred at Open File+.vi:Open File'

 

Possible reason(s):

LabVIEW:  File not found. The file might have been moved or deleted, or the file path might be incorrectly formatted for the operating system. For example, use \ as path separators on Windows, : on Mac OS, and / on Linux. Verify that the path is correct using the command prompt or file explorer.
=========================
NI-488:  Nonexistent GPIB interface.

 

Hope that someone can help me with this issue since it's rather annoying! aarghh!

0 Kudos
Message 1 of 19
(5,196 Views)

Re-organised my folder structure last week
Just check whether you have hardwired the file path in lv.
0 Kudos
Message 2 of 19
(5,188 Views)

yes i have hardwired the file path. however in a single sub-VI style. Should i get it back up to the main block diagram?

 

interestingly btw, if i 'thin' out my file structure, it can read the files without error (file within 2 layers of folders: clincal/stroke/test.txt) however after 3 or more layers (study1/clinical/stroke/test.txt) it comes up with the error again

 

 

0 Kudos
Message 3 of 19
(5,184 Views)

The number of layers doesn't matter. What is important is the native root folder that you have hardcoded and the build of relative folders followed it.

 

Message 4 of 19
(5,168 Views)

J.DECHET wrote:

The number of layers doesn't matter.


It does if it makes the full path to the file (including the name of the file itself) too long. On Windows you're still limited to 256 characters. 

Message 5 of 19
(5,156 Views)

hmmz smercurio_fc, you might be onto something there. Forgot about that.

 

also, stupid question but how does the file path handle spaces in the destination folder. For example i have one folder called: 'clinical data'. Could that cause the confusion, cause when cutting that folder out of the equation the file path can just run the .txt files without a problem.

 

Thanks for the replies btw to all! I really appreciate it!

0 Kudos
Message 6 of 19
(5,152 Views)

MrHond wrote:
also, stupid question but how does the file path handle spaces in the destination folder. For example i have one folder called: 'clinical data'. Could that cause the confusion, cause when cutting that folder out of the equation the file path can just run the .txt files without a problem.

The file path handle doesn't care. It's the operating system that matters here. Are you actually using file path controls/constants, or are you messing around (incorrectly) with strings?

Message 7 of 19
(5,148 Views)

Sure, I had a bad reflex Smiley Sad but I'm not used to have program structures with path of 256 characters but I am conscient this rare problem could be real.

 

The point I wanted to highlight is only to be attentive with the build of relative path.

0 Kudos
Message 8 of 19
(5,145 Views)
Solution
Accepted by topic author Paddy1985

I'm using the standard file path controls from within LabVIEW 8.5.

not treating them as strings

 

although, coming back to the limited caracters from Windows, i think that might be the problem. Subfolder after subfolder might indeed be the cause of the limited length within path controls.

 

I think i might 'unstructure' them again, and see how that goes.

 

Cheers for all the comments etc, and let's hope it works!

 

Patrick

0 Kudos
Message 9 of 19
(5,143 Views)

MrHond wrote: 

although, coming back to the limited caracters from Windows, i think that might be the problem. Subfolder after subfolder might indeed be the cause of the limited length within path controls.


You can easily test this. At the point where the Open File function is, place a Path to String function, and then use the String Length function to get its length. Place a probe and see what the length is.

0 Kudos
Message 10 of 19
(5,134 Views)