The code works fine till when it hit client.submit()
The error I am getting is:
File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 57, in application
response = frappe.handler.handle()
File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 22, in handle
data = execute_cmd(cmd)
File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 53, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 923, in call
return fn(*args, **newargs)
TypeError: submit() takes exactly 1 argument (0 given)
Don’t know if I used the submit wrong or there is an internal code bug.
I tried: client.submit([record]), with no luck.
Partial error message:
"doclist": json.dumps(doclist)
File “/usr/local/nagios/libexec/frappeclient/frappeclient.py”, line 190, in post_request
res = self.post_process(res)
File “/usr/local/nagios/libexec/frappeclient/frappeclient.py”, line 203, in post_process
rjson = response.json()
File “/usr/local/lib/python2.7/dist-packages/requests/models.py”, line 892, in json
return complexjson.loads(self.text, **kwargs)
File “/usr/lib/python2.7/json/init.py”, line 338, in loads
return _default_decoder.decode(s)
File “/usr/lib/python2.7/json/decoder.py”, line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “/usr/lib/python2.7/json/decoder.py”, line 384, in raw_decode
raise ValueError(“No JSON object could be decoded”)
ValueError: No JSON object could be decoded
I haven’t figured how to do Submit yet. but you are looking at the wrong error message. The real errors are within the HTML codes that you get on your terminal.
It is unclear to me what datatypes the client.submit function is expecting.
A dictionary doesn’t work: {"name"; "record"}
A list doesn’t work: ["record"]
A whole document doesn’t work: submit_record = client.get_doc(submit_doctype, name=name["name"]) client.submit(submit_record)
All I get is the same error: TypeError: submit() takes exactly 1 argument (0 given)
Or when I try: client.submit(submit_doctype, name)
I get: TypeError: submit() takes 2 positional arguments but 3 were given
So the answer to this is that it’s looking for a JSON-esque record to submit, eg the output of get_doc … make your changes to the record and then doc.submit()
That’s what the documentation says, but I missed it this first ten times. Hopefully this answer will help the next person struggling with this.