grimbough / rhdf5

Package providing an interface between HDF5 and R
http://bioconductor.org/packages/rhdf5
60 stars 21 forks source link

Problems with non-ASCII file paths on Windows #52

Closed sda030 closed 4 years ago

sda030 commented 4 years ago

rhdf5::h5dump() (and perhaps other functions in this package) fails to open a file in a path with a long filename, which is rather annoying.

tmp <- rhdf5::h5dump("G:/5 Prosjekter/20941 14 år etter/Sperret/Stephan_analyser/Syntax/Longfoldernamewhichisuncommonbuthappens/m4_1a.gh5") Error in H5Fopen(file, native = native) : HDF5. File accessibilty. Unable to open file. tmp <- rhdf5::h5dump("H:/m4_1a.gh5")
(this succeeds). Same file.

grimbough commented 4 years ago

Thanks for the bug report.

I would be really helpfuly if you could test whether this error occurs if you use a shorter path, but which still contains a non ASCII character. So something like:

rhdf5::h5dump("H:/år/m4_1a.gh5")

It's just a hunch, but I think that's a more likely culprit that the path length.

sda030 commented 4 years ago

Oh, I'm silly. Yes, of course it's due to ASCII. Just happened that all our projects had a non-ASCII character in the name.

Alas, seems so many of my daily R-related struggles are due to non-UTF8 encodings within files - and now filenames too... Still though, I haven't experienced such an issue with other packages?

grimbough commented 4 years ago

Thanks for looking into it. I'm not ruling out that this is an rhdf5 specific problem, rather than something generic to R, but this information helps me know what to look for.

Something similar was reported quite a while back in https://support.bioconductor.org/p/108548/ and I got it working for that user, but I wonder if my prediction of 'I expect it will still cause issues if more exotic characters are present.' has now come true.

grimbough commented 4 years ago

Hopefully this has been fixed with the combination of rhdf5 2.21.5 and Rhdf5lib 1.9.1. I now get:

> h5dump("C:/Users/Mike Smith/Code/år/TEST.h5")
$tmp
 [1]  1  2  3  4  5  6  7  8  9 10