Trying import frappeclient

Im strying import frappeclient to insert a new doc using the following example:

from frappeclient import FrappeClient

client = FrappeClient("example.com", "user@example.com", "password")

# Prepare a customer dict that we will use to create a new
# customer in ERPNext
doc = {"doctype": "Customer",
       "customer_name": "Example Inc.",
       "customer_type": "Company",
       "website": "example.net"}

# create new record in ERPNext
client.insert(doc)

Error: no module named frappeclient

Try
from frappe.frappeclient import FrappeClient

frappe@erpnext:~/frappe-bench$ find . -name frappeclient.py
./apps/frappe/frappe/frappeclient.py

@spoojary
“no module named frappe.frappeclient”

@clarkej
“No such file or directory”

Any idea?

Do you mean to say you cannot access the file system or find frappeclient.py?

I don’t know, just not find it :frowning:

I found the file frappeclient.py manually

That’s not much help to troubleshoot!

I can only assume you have no console access to your ERPNext server, possibly you are accessing say a VPS host.

It’s not a VPS host, but server host
Tried move the script.py file to the same folder of frappeclient.py but not worked at all

Why are you using frappeclient? Instead of that simple new_doc() or get_doc() is sufficient here.

e.g.

frappe.get_doc({
	"doctype": "Customer",
	"customer_name": "Example Inc.",
	"customer_type": "Company",
	"website": "example.net",
	"customer_group": "Government",
	"territory": "Rest Of The World"
}).insert(ignore_permissions=True)

ok so indeed you have console access!?

All I can suggest: To run in developer_mode with ‘bench start’, and routinely identify the results of your change in the frappe-bench/logs.

good luck

Cause this:

Yes, I’m doing a ssh to the machine and developing there.
I’ll try your suggestion

Thanks good feedback @Leonardo_Augusto - don’t fear a forum search for clues and answers ok!?