Files on external drive not accessible with hdf_open() [message #93801] |
Thu, 20 October 2016 05:28  |
Helder Marchetto
Messages: 520 Registered: November 2011
|
Senior Member |
|
|
Hi,
I'm encountering a strange problem opening a file on an external drive. I'm not sure if IDL or the system is generating the error.
So I use a command like this to open an hdf file:
f_id = hdf_open(inFileName, /read)
And I get a -1 as a result.
If I test for the file, I get 1 (=file existing and readable):
print, file_test(inFileName, /read)
This happens when my external drive turns off (goes idle) after a short brake or when I close and reopen my laptop (haven't checked which one...). Unplugging and replugging (unmounting, mounting) the drive solves the error. All other options I tried did not (reset IDL session, close-reopen IDL).
The command:
help, /files
does not give any information.
My question: how can I catch this error? I could of course test if hdf_open is -1 and file_test is 1 then tell the user "unmount and remount your drive", but maybe there is a better way to do this...
I would appreciate any help on the topic.
Cheers,
Helder
|
|
|
Re: Files on external drive not accessible with hdf_open() [message #93802 is a reply to message #93801] |
Thu, 20 October 2016 06:55  |
Helder Marchetto
Messages: 520 Registered: November 2011
|
Senior Member |
|
|
On Thursday, October 20, 2016 at 2:28:29 PM UTC+2, Helder wrote:
> Hi,
> I'm encountering a strange problem opening a file on an external drive. I'm not sure if IDL or the system is generating the error.
>
> So I use a command like this to open an hdf file:
>
> f_id = hdf_open(inFileName, /read)
>
> And I get a -1 as a result.
> If I test for the file, I get 1 (=file existing and readable):
>
> print, file_test(inFileName, /read)
>
> This happens when my external drive turns off (goes idle) after a short brake or when I close and reopen my laptop (haven't checked which one...). Unplugging and replugging (unmounting, mounting) the drive solves the error. All other options I tried did not (reset IDL session, close-reopen IDL).
>
> The command:
> help, /files
> does not give any information.
>
> My question: how can I catch this error? I could of course test if hdf_open is -1 and file_test is 1 then tell the user "unmount and remount your drive", but maybe there is a better way to do this...
>
> I would appreciate any help on the topic.
>
> Cheers,
> Helder
Forgot to mention, that inFileName is an explicit file name (path+name) and is a scalar... in case anybody except me is wondering what the h... is going on.
Cheers,
Helder
|
|
|