LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

system exec - Not finding a file

Hi,

 

I am using the system exec vi to call a patch file that prints a .txt. or .prn file depending on the request of the user. I was ahving some issues with it not being able to find the batch file however I have solved that but now i get this error from the standard output string:

 

Error: could not open print_test.txt for reading

 

print_test.txt is the file it is trying to print. I am not sure what is causing this

any ideas would be appreciated

 

Thank you

0 Kudos
Message 1 of 8
(3,540 Views)

Hi Dowden,

 

system exec seems to find the file. It's not possible to open the file - most probably some other program is accessing this file thus blocking access for other programs...

Best regards,
GerdW


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

Hi Dowden,

 

Thanks for the post!

 

I beleive there is another reason - the file could be in an area with limited access, maybe try it in admin login and maybe (if its not the case) place the file in My Documents and see if it works. Sometimes errors like this as seen if your reading/writing a file to the program files (and whole host of locatiosn of Vista).

 

Please let us know how you get on / more details if the problem is still an issue,

 

kind Regards,
James.

Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
0 Kudos
Message 3 of 8
(3,509 Views)
Another issue issue could be that your system exec is not running in the proper directory.  Looking at the System Exec help, are you specifying the working directory to be the directory where your print_test.txt file is?  Alternatively, you can specify the entire path in your System Exec command.
0 Kudos
Message 4 of 8
(3,497 Views)

Hi Dowden1, I hope your well.

 

Did you manange to resolve your issue, if you could please update us that would be great!

 

Kind Regards,
James.

Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
0 Kudos
Message 5 of 8
(3,454 Views)

Hi all,

 

I think I have solved the problem by moving the files to another location, from my experimentation with this it seems that there is a limit to the length of the path which can be used. so simply moving the files to another folder resulting in a shorter path seems to work.

 

This will work as a temporary solution, but I am a little bit worried that people may rearrange the file structure and this will happen again so I am still looking into a better solution.

 

Thank you for all your help

 

Adam Dowden

0 Kudos
Message 6 of 8
(3,427 Views)

Hi Adam,

 

atleast you could give a warning message when the path gets too long Smiley Wink

Message Edited by GerdW on 12-02-2008 10:53 AM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 8
(3,423 Views)

Hi Adam,

 

Thanks for the post and I hope your well today.

 

There are maximum limits, imposed by Windows , on how long you can have an ASCI file name and the full path as follows:

MAX_FILE_NAME is 256
MAX_PATH is 260

 

I beleive this is correct ... however does seem to be some confusiong. You can make your own mind from a very resources...

 

Forum

Max length of VI file paths and file names

http://forums.ni.com/ni/board/message?board.id=170&message.id=28207&requireLogin=False

Hope this helps alittle,

http://www.british-genealogy.com/forums/archive/index.php/t-8252.html

msdn

Naming a File or Directory

http://msdn.microsoft.com/en-us/library/aa365247.aspx

Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
Message 8 of 8
(3,414 Views)