Download File from Mega using mega.py
I'm trying to download a file from my Megadrive using mega.py module
while running the code as specified in mega module home url
I'm getting a Permission error as specified below
Code:
from mega import Mega
mega = Mega()
email ="example@example.com"
password ="xxxxxxxxxx"
m = mega.login(email, password)
filename = "filename.jpg"
file = m.find(filename)
m.download(file)
Error:
Traceback (most recent call last):
File "C:\Users\xxxx\AppData\Local\Programs\Python\Python39\lib\shutil.py", line 806, in move
os.rename(src, real_dst)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\AppData\\Local\\Temp\\megapy_d6ozyjm' -> 'filename.jpg'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Desktop\Mega.py", line 14, in <module>
m.download(file)
File "C:\Users\AppData\Local\Programs\Python\Python39\lib\site-packages\mega\mega.py", line 564, in download
return self._download_file(file_handle=None,
File "C:\Users\AppData\Local\Programs\Python\Python39\lib\site-packages\mega\mega.py", line 745, in _download_file
shutil.move(temp_output_file.name, output_path)
File "C:\Users\AppData\Local\Programs\Python\Python39\lib\shutil.py", line 821, in move
os.unlink(src)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\\AppData\\Local\\Temp\\megapy_d6ozyjm'