function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
KuenKuen 

Python Beatbox Upsert Error

Hey all, I currently have a weird problem. When I use the upsert command, it gives me an error that it's expecting 2 arguments when it got 0, however, I have given it 2 arguments and can't see where the error is happening.

ERROR: instancemethod expected at least 2 arguments, got 0

 

The code below is where it errors. beatbox is the beatbox object, that's already been logged in. The up_param is the salesforce matching, and the objects is a list of dictionaries that contain the information to upload. They all have data.

 

 

results = beatbox.upsert(up_param, objs)

 

 

Is there some form of documentation for this (it sometimes works, it sometimes doesn't)? I wasn't the one who wrote the code, and thus have been hacking away at identifying the problem and have narrowed it down to this. I am using python 2.6 and beatbox 19 incase this matters.

 

EDIT: Identified the error to be python side. The copy can't copy some instance (Account) and that is why it's a problem. Now time to figure out ways to make it work.

 

After stepping through it says there's an error in sObjectsCopy=copy.deepcopy(sObjects). Now I'm completely stumped...

 

Any help would be appreciated.

 

Thanks,

 

Kuen

Best Answer chosen by Admin (Salesforce Developers) 
SuperfellSuperfell

perhaps i'm missing reading this, but it appears to be putting a function/method in the map, it needs to be an actual value.

All Answers

SuperfellSuperfell

Are you using some wrapper about beatbox? there is no copy.deepcopy call in the beatbox codebase. (demo.py includes an example of calling upsert)

KuenKuen

Thanks for replying Simon,

 

I am not using a wrapper.. I just stepped through the code using pdb and that's what I found. My version of beatbox may be different from the one that it was developed on. The problem is when it refers to this in the dictionary...

 

 

'total__c': <bound method Account.total of <Account:  - >>, 

 

Thanks,

 

Kuen

SuperfellSuperfell

perhaps i'm missing reading this, but it appears to be putting a function/method in the map, it needs to be an actual value.

This was selected as the best answer
KuenKuen

Reply, yes that would be the reason why it's failing... Weird, I thought that would be allowed since the previous person who wrote it uploaded the data into SF and it appeared to work.

 

Thank you so much for telling me that it doesn't work! I've been pulling my hair out all day every time I go back to seeing this.