FileNotFoundError: [Errno 2] No such file or directory when writing to_csv
See original GitHub issueI’m getting the following error when trying to write using to_csv. It works fine using pandas.
import dask.dataframe as dd
Filename = '\FreshPlanet_SongPop_0317.txt'
Filepath = r'O:\Song Pop\01 Originals\2017'
OutputFilepath = r'O:\Song Pop\01 Originals\2017\FreshPlanet_SongPop_0317_FORMATTED.txt'
df = dd.read_csv(Filepath + Filename, sep='\t', encoding='ansi', keep_default_na=False)
dd.to_csv(df=df, filename=OutputFilepath, index=False, header=False, float_format='%.7f', sep='\t')
Error:
Traceback (most recent call last):
File "C:/Users/PycharmProjects/Freshplanet/TestDask.py", line 12, in <module>
dd.to_csv(df=df, filename=OutputFilepath, index=False, header=False, float_format='%.7f', sep='\t')
File "C:\ProgramData\Miniconda3\lib\site-packages\dask\dataframe\io\csv.py", line 505, in to_csv
delayed(values).compute(get=get)
File "C:\ProgramData\Miniconda3\lib\site-packages\dask\base.py", line 99, in compute
(result,) = compute(self, traverse=False, **kwargs)
File "C:\ProgramData\Miniconda3\lib\site-packages\dask\base.py", line 206, in compute
results = get(dsk, keys, **kwargs)
File "C:\ProgramData\Miniconda3\lib\site-packages\dask\threaded.py", line 75, in get
pack_exception=pack_exception, **kwargs)
File "C:\ProgramData\Miniconda3\lib\site-packages\dask\local.py", line 521, in get_async
raise_exception(exc, tb)
File "C:\ProgramData\Miniconda3\lib\site-packages\dask\compatibility.py", line 60, in reraise
raise exc
File "C:\ProgramData\Miniconda3\lib\site-packages\dask\local.py", line 290, in execute_task
result = _execute_task(task, data)
File "C:\ProgramData\Miniconda3\lib\site-packages\dask\local.py", line 271, in _execute_task
return func(*args2)
File "C:\ProgramData\Miniconda3\lib\site-packages\dask\bytes\core.py", line 29, in write_block_to_file
with lazy_file as f:
File "C:\ProgramData\Miniconda3\lib\site-packages\dask\bytes\core.py", line 311, in __enter__
f = f2 = self.myopen(self.path, mode=mode)
File "C:\ProgramData\Miniconda3\lib\site-packages\dask\bytes\local.py", line 61, in open
return open(path, mode=mode)
FileNotFoundError: [Errno 2] No such file or directory: 'O:\\Song Pop\\01 Originals\\2017\\FreshPlanet_SongPop_0317_FORMATTED.txt\\6.part'
Issue Analytics
- State:
- Created 6 years ago
- Comments:25 (12 by maintainers)
Top Results From Across the Web
Error in Python IOError: [Errno 2] No such file or directory: 'data ...
In Python, I have a script, I'm trying to use the python open("data.csv") command to open a CSV file that I have in...
Read more >How to fix FileNotFoundError Errno 2 no such file or directory
There are several reasons why the FileNotFoundError Errno 2 No such file or directory error can occur: 1. Misspelled filename.
Read more >Filenotfounderror Errno 2 no such file or directory Solution
Filenotfounderror Errno 2 no such file or directory is a python error always comes when you are not defining proper path for the...
Read more >Python FileNotFoundError: [Errno 2] No such file or directory ...
This error is usually raised when you use the os library. You will see an IOError if you try to read or write...
Read more >How to resolve FileNotFoundError: [Errno 2] No such file or ...
Coding example for the question How to resolve FileNotFoundError: [Errno 2] No such file or directory: in Pandas?-Pandas,Python.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@kingblah you need to provide a globstring (including a
*
) or a list of filenames: http://dask.pydata.org/en/latest/dataframe-api.html#dask.dataframe.to_csvIf the user does not pass the full path to the file (on Unix type systems this means a path that starts with a slash), the python file path is interpreted relatively to the current working directory. The current working directory usually is the directory in which you started the program. In order to make this work, the directory containing the python executable must be in the PATH, a so-called environment variable that contains directories that are automatically used for searching executables when you enter a command.
In any case, if your Python script file and your data input file are not in the same directory, you always have to specify either a relative path between them or you have to use an absolute path for one of them.