3

Minimal reproduceable example:

This code:

file_path =  r"\\myserver\e\somedir\mycsv.csv"
my_df = dd.read_csv(file_path, dtype="str")

Results in:

FileNotFoundError: [WinError 3] The system cannot find the path specified: 'myserver/e/somedir/mycsv.csv'

However:

os.path.isfile(file_path)

returns True

This has me stumped. I'm pretty sure it has to do with file_path being a UNC path and it including "\server_name" at the beginning, but maybe I am wrong. According to the Dask/pandas documentation, this should work fine.

jottbe
  • 4,228
  • 1
  • 15
  • 31
healthDog
  • 31
  • 1
  • The output is suspicious, because the two backslahes were removed. Have you already tried to open the file in python like `with open(file_path, 'rt') as fp:` and then just read it with `my_df = dd.read_csv(fp, dtype="str")`. Does that work? If that works, you can also try to read it with pandas directly with `engine='python'. – jottbe Sep 12 '19 at 20:34
  • Thanks for that suggestion. This returns: File "C:\ProgramData\Anaconda3\lib\site-packages\fsspec\implementations\local.py", line 118, in _strip_protocol if path.startswith('file://'): AttributeError: '_io.TextIOWrapper' object has no attribute 'startswith' – healthDog Sep 12 '19 at 20:45
  • Oh, that sounds like a bug. Have you already tried updating your conda environment? maybe it is a version incompatibility in the libraries (just guessing). I think it is done using `conda update --all` – jottbe Sep 12 '19 at 22:54
  • Thanks, I had previously updated the entire conda installation. But I decided to update dask alone and this resolved the issue. Thanks again for your help!!!! – healthDog Sep 13 '19 at 18:19
  • See [`fsspec.implementations.local.make_path_posix`](https://github.com/intake/filesystem_spec/blob/master/fsspec/implementations/local.py#L146) - if this string manipulation is wrong, please submit the correct one as a PR. – mdurant Sep 13 '19 at 18:43
  • Mapping the UNC path to a drive letter is one solution. However, other users of the code would require the same drive letter. – datalifenyc Dec 11 '19 at 03:24

0 Answers0