"The system cannot find the path specified" (shutil.py)
rcarloscalderon opened this issue · 6 comments
The process starts by getting campaign data for my accounts and creates a temp file location and the .csv.gz. However, the shutil.py throws an error that it can't find the path. Any suggestions?
Traceback (most recent call last):
File "c:\users\myname\python\python36-32\lib\shutil.py", line 546, in move
os.rename(src, real_dst)
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\myname\\AppData\\Local\\Temp\\1\\tmpi4m5wlod\\facebook-account-structure_v1.csv.gz' -> '\\tmp\\facebook\\facebook-account-structure_v1.csv.gz'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\myname\Python\Python36-32\Scripts\download-facebook-performance-data-script.py", line 11, in <module>
load_entry_point('facebook-ads-performance-downloader==1.3.0', 'console_scripts', 'download-facebook-performance-data')()
File "c:\users\myname\python\python36-32\lib\site-packages\click\core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "c:\users\myname\python\python36-32\lib\site-packages\click\core.py", line 697, in main
rv = self.invoke(ctx)
File "c:\users\myname\python\python36-32\lib\site-packages\click\core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\users\myname\python\python36-32\lib\site-packages\click\core.py", line 535, in invoke
return callback(*args, **kwargs)
File "c:\users\myname\python\python36-32\lib\site-packages\facebook_downloader\cli.py", line 38, in download_data
downloader.download_data()
File "c:\users\myname\python\python36-32\lib\site-packages\facebook_downloader\downloader.py", line 37, in download_data
download_data_sets(ad_accounts)
File "c:\users\myname\python\python36-32\lib\site-packages\facebook_downloader\downloader.py", line 47, in download_data_sets
download_account_structure(ad_accounts)
File "c:\users\myname\python\python36-32\lib\site-packages\facebook_downloader\downloader.py", line 81, in download_account_structure
shutil.move(str(tmp_filepath), str(filepath))
File "c:\users\myname\python\python36-32\lib\shutil.py", line 560, in move
copy_function(src, real_dst)
File "c:\users\myname\python\python36-32\lib\shutil.py", line 257, in copy2
copyfile(src, dst, follow_symlinks=follow_symlinks)
File "c:\users\myname\python\python36-32\lib\shutil.py", line 120, in copyfile
with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\myname\\AppData\\Local\\Temp\\1\\tmpi4m5wlod\\facebook-account-structure_v1.csv.gz'
I think you need to set the data_dir
option. It defaults to '/tmp/facebook', which doesn't seem to exist on your machine
Thanks for the prompt reply! I did set the data_dir to a folder. The process creates the folder. But, it is still creating a temp folder in my appdata.
@rcarloscalderon can you see what does the temp folder contain? Beside that, setting the data_dir
flag it worked?
I was already defining data_dir before.
The process creates a temp folder and csv.gz file each time it runs. But, it disappears before the process finishes.
Appdata\Local\Temp\1\(random)\facebook-account-structure-v1.csv.gz
I think you are using an old version of the package, the stack above says
File "c:\users\myname\python\python36-32\lib\site-packages\facebook_downloader\downloader.py", line 81, in download_account_structure shutil.move(str(tmp_filepath), str(filepath))
but at line 81 of that file there's a blank line
Could you update it and retry? Hopefully that will be enough, but if it doesn't work it would be useful for us to see an updated log and match the line numbers.
The disappearance of the file is caused by this line, the TemporaryDirectory
context exits and deletes the temp files even in case of error (it's the expected behavior, to avoid leaving data), we need to understand why the error is generated.
I hope this got resolved, closing due to inactivity