LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

file access denied after error

Dear all,

this is one particular form of this problem, but i have in general.

This is the snippet of a VI thats creates a screenshot of a certain VI front panel, saves it to disk and then attaches it to an email.

email.PNGnow this worked one time, the second time i get

Error 1 occured in Write JPEG file.vi

Possible reason(s):

LabVIEW:  An input parameter is invalid. For example if the input is a path, the path might contain a character not allowed by the OS such as ? or @.
=========================
NI-488:  Command requires GPIB Controller to be Controller-In-Charge.
Complete call chain:
     Write JPEG File.vi
     CNHT_v8.lvlib:Email Notification.vi

 

i cannot modify the .jpg file anymore, it is "opened by labview". I suppose there is some open reference conflict, but i have totally no clue how to find that open reference and close it. can you help me? Thank you!

0 Kudos
Message 1 of 14
(4,821 Views)

I found the problem is in the attachement function. I cannot make it "close" the file anymore, or let it go. Do you know how?

 

this file may help.

0 Kudos
Message 2 of 14
(4,801 Views)
I hope you might have taken the code from here : Sending SMTP Email Attachments from LabVIEW : https://decibel.ni.com/content/docs/DOC-7451
-Can you check by moving the Close Reference for Attachment after the Attachment Collection.
-It would be nice if you post your VI.
Thanks
uday
0 Kudos
Message 3 of 14
(4,799 Views)

 

[simultanious posting...]
Thank you for your reply.


@udka wrote:
-Can you check by moving the Close Reference for Attachment after the Attachment Collection.

No, the Attachment Collection does not provide another terminal.


@udka wrote:
-It would be nice if you post your VI.

I did in my reply above, its a smalles running snippet reproducing the same behaviour (ruling out anything connected to the emailing)

email.PNG

 


 

0 Kudos
Message 4 of 14
(4,791 Views)
I have run the code you posted multiple times and i didn't get any errors.
-Are you sure the file path you gave is correct? Valid Folder exist?
-Do you have read write permission to that folder?
-Can you try saving to some other Folder/Drive and then see if you still get same error?
Thanks
uday
0 Kudos
Message 5 of 14
(4,786 Views)

@OPCer wrote:

Dear all,

this is one particular form of this problem, but i have in general.

This is the snippet of a VI thats creates a screenshot of a certain VI front panel, saves it to disk and then attaches it to an email.

email.PNGnow this worked one time, the second time i get

Error 1 occured in Write JPEG file.vi

Possible reason(s):

@Labview:  An input parameter is invalid. For example if the input is a path, the path might contain a character not allowed by the OS such as ? or
=========================
NI-488:  Command requires GPIB Controller to be Controller-In-Charge.
Complete call chain:
     Write JPEG File.vi
     CNHT_v8.lvlib:Email Notification.vi

 

i cannot modify the .jpg file anymore, it is "opened by labview". I suppose there is some open reference conflict, but i have totally no clue how to find that open reference and close it. can you help me? Thank you!


I think Uday was on the right track, talking about the close used to destroy the attachement node. Wiht the way that code is wired, LV COULD schedule the "close" to occur before "AttachementCollection" node executes. That would invalidate the reference and trigger the error becuase you have to pass a valid references that has not been closed.

 

Try to run the errror wire from the "AttachementCollection" close to the input of the close used on the "Attachment" close to force the close of the reference to happen after all of the others stuff.

 

And...

If LV still has that file open somewhere, that may be preventing you rfrom opening it. You may have to restart LV and/or the machine to clear up that issue.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 14
(4,769 Views)

I doubt this is it but you might want to use some data flow, and ensure that the attachment reference doesn't get closed until after AttachmentCollection is done with it.  At the moment you are closing that reference in parallel to adding it, would could be causing trouble.

0 Kudos
Message 7 of 14
(4,761 Views)

Dear all,

thank you for your replies. If this forum allowed me to edit the initial post, you would not need to point out things i already excluded from being the cause of the issue.

My wrapup:

If I run this code (see attachment):

email.PNG

The front panel screen is successfully saved as .jpg. But it is also opened by LV. Any attempt to delete or rename the file results in this dialog (Windows explorer):

error.PNG

However I am allowed to open/view the image.

running the VI a second (and any additional time) results in the following error:

error2.PNG

 

To answer your points:

-valid file path: the file is being created successfully.

-read/write permission: yes.

-try different file name / path / drive: does not change the behaviour

-AttachementCollection: is excluded, the error occurs without this function.

-restart LV: does not cure the problem and is very unhandy (big VIs running...)

-Version: LabView 14.0

-removing the "Attachement" function from the block diagram cures the problem

 

Do you have any more Ideas?

0 Kudos
Message 8 of 14
(4,740 Views)

@OPCer wrote:

Dear all,

thank you for your replies. If this forum allowed me to edit the initial post, you would not need to point out things i already excluded from being the cause of the issue.



Not sure what you mean by those sentences.  People don't know what you have already excluded.  And editing the initial message doesn't help, because no one is going to see any changes in a message if they have already read it.

 

I tried running your VI that you attached in message #2.  I ran it several times in a row saving to my desktop.  Never had an error.  Where exactly is the d:| drive you are saving to?  Is there any reason it might take longer than normal to close a file?  Could there be any virus scanning going on that would lock a newly created file while it is being scanned?

 

I ask because your VI works fine for me, which makes me think it is something special about your situation.  I am speculating as to things it might be.

0 Kudos
Message 9 of 14
(4,734 Views)

-I repeat: http://forums.ni.com/t5/LabVIEW/file-access-denied-after-error/m-p/3343436/highlight/true#M982124

-I ran your vi multiple times was able to delete file without no error.

 

Few more tests:

-Remove the attachment property node and check only with write to jpeg and see if it is still same.

-Can you check if you have the latest Microsoft .NET Framework installed?

-What is your windows version 7,8, or 10 or other and 32 bit or 64 bit? and Labview 32 bit or 64 bit?

 

-Yes we will ask more questions because it's working for us and not for you and we are not having the same situation as yours.

Thanks
uday
0 Kudos
Message 10 of 14
(4,727 Views)