Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

delete_url deletes one folder instead of the linked file #73

Open
ZuriPL opened this issue Nov 29, 2021 · 1 comment
Open

delete_url deletes one folder instead of the linked file #73

ZuriPL opened this issue Nov 29, 2021 · 1 comment

Comments

@ZuriPL
Copy link

ZuriPL commented Nov 29, 2021

I'm trying to write a script to sync one of the folders one my pc to a folder in MEGA

My idea was to to write a loop which deletes a certain file in MEGA and upload a new one (both have the same name). I have been struggling with the deleting part though. Here's a part of my code (that matters)

`j = 0

for i in pathlib.Path(output).iterdir():
m.delete_url(m.get_link(m.find(get_filename(output, j))))
m.upload(i, cloud_dest[0])
j += 1`

the get_filename() function i have in my other library file, but I did some debug prints which show it works (if i print m.get_link(m.find(get_filename(output, j))) it succesfully returns me the link to the correct file. So, since i input the correct link to the delete_url function, I cannot understand why the function moves to trash one directory from my root MEGA share, instead of the file I ask it to. Abd sunce I have more files than folders, the script crashes midway, with this error:

Traceback (most recent call last): File "c:\Users\micha\Documents\VSCode\sync.py", line 28, in <module> m.delete_url(m.get_link(m.find(get_filename(output, j)))) File "C:\Users\micha\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\mega\mega.py", line 528, in delete_url return self.move(file_id, 4) File "C:\Users\micha\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\mega\mega.py", line 946, in move return self._api_request({ File "C:\Users\micha\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\tenacity\__init__.py", line 293, in wrapped_f return self.call(f, *args, **kw) File "C:\Users\micha\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\tenacity\__init__.py", line 359, in call do = self.iter(retry_state=retry_state) File "C:\Users\micha\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\tenacity\__init__.py", line 320, in iter return fut.result() File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2544.0_x64__qbz5n2kfra8p0\lib\concurrent\futures\_base.py", line 438, in result return self.__get_result() File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2544.0_x64__qbz5n2kfra8p0\lib\concurrent\futures\_base.py", line 390, in __get_result raise self._exception File "C:\Users\micha\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\tenacity\__init__.py", line 362, in call result = fn(*args, **kwargs) File "C:\Users\micha\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\mega\mega.py", line 188, in _api_request raise RequestError(int_resp) mega.errors.RequestError: EACCESS, Access violation (e.g., trying to write to a read-only share)

What's the issue here? Maybe I'm doing something wrong?

@arihantai
Copy link

Same issue for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@ZuriPL @arihantai and others