cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Re: Python TypeError using Dropbox API move_v2function

Python TypeError using Dropbox API move_v2function

ctubbs
Dropbox Staff

Hi,  I am trying to use the API to batch rename file. I had specific questions are around the move_v2 function:

 

I’m running dropbox.files.move_v2(params), where the args are from_path and to_path – As I understand it, we can’t rename files specifically, rather we just use move/move_v2.

 

However, I keep getting the below error:

 

unnamed.png

 

 

 

 

I know the function exists as a result, but clearly I’m not using it correctly.

11 Replies 11

Greg-DB
Dropbox Staff

I'm not sure off hand what the issue may be, but calling `if result.has_more` for each `entry` doesn't look like what you'd want to do. Once you're inspecting a particular entry, it shouldn't matter if there is another page of entries to retrieve (since you've already retrieved the entry you're operating on).

 

I recommend stepping through with a debugger to see where the code execution is going and why, and what the variables look like at any point in time.

 

Perhaps what you're seeing is the new entries created by your own move operations? You may need to implement some way to avoid operating on files that you've already moved, or maybe retrieve the full file listing before you start moving files, depending on exactly what you want your program to do and how.

LRomano
Explorer | Level 3

Hmmmmm, yes that makes sense actually, that the move operation would in a sense 'reset' the file in terms of where the cursor is, and thus might get included in a future operation.

 

Problem is the full file list is 160k total files across a number of directories, and even counting them all takes ~8 mins.

 

I think a workaround is to include an if statement to exclue any file that beginswith('str'), as all the strings that I'm appending to files begin with 'zas', but it's not exactly elegant. 🙂

Need more support?