Quickbooks_migrator.py failing AttributeError: 'WebApplicationClient' object has no attribute 'populate_token_attributes'

ERPNext version
ERPNext: v11.1.2 (master)

Frappe Framework: v11.1.2 (master)

When running bench install-app erpnext on freshly created site I get this message:

Traceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 174, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 97, in
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/init.py”, line 25, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 168, in install_app
_install_app(app, verbose=context.verbose)
File “/home/frappe/frappe-bench/apps/frappe/frappe/installer.py”, line 149, in install_app
File “/home/frappe/frappe-bench/apps/frappe/frappe/installer.py”, line 173, in add_to_installed_apps
File “/home/frappe/frappe-bench/apps/frappe/frappe/installer.py”, line 237, in post_install
File “/home/frappe/frappe-bench/apps/frappe/frappe/installer.py”, line 255, in init_singles
doc = frappe.new_doc(single)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 655, in new_doc
return get_new_doc(doctype, parent_doc, parentfield, as_dict=as_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/create_new.py”, line 20, in get_new_doc
frappe.local.new_doc_templates[doctype] = make_new_doc(doctype)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/create_new.py”, line 38, in make_new_doc
“docstatus”: 0
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 721, in get_doc
doc = frappe.model.document.get_doc(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 69, in get_doc
return controller(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py”, line 39, in init
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/requests_oauthlib/oauth2_session.py”, line 68, in init
self.token = token or {}
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/requests_oauthlib/oauth2_session.py”, line 114, in token
AttributeError: ‘WebApplicationClient’ object has no attribute ‘populate_token_attributes’

Looks like quickbooks_migrator is creating the problem. Anybody else faced this issue? I have faced it multiple times on multiple servers.

1 Like


def token(self, value):
    self._client.token = value
    #self._client.populate_token_attributes(value)   <----- Remarked this line 114 in /home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/requests_oauthlib/oauth2_session.py

Not sure what else to do but had to do this to continue creating new sites. If somebody has insights on this it will be useful to know the consequences.

1 Like

I too got the same issue and the above worked. Thanks for posting this so that I was able to play around with the installation. But, this is a blocker for me to go into production as I don’t know the consequences of this fix.

I ran into a very similar problem and eventually discovered that I had an obsolete OAuth2 library in /usr/lib/python2.7/dist-packages. Once I had cleared this and the code started using the current library (which had ended up in /usr/local/lib/python2.7/dist-packages ) the code progressed past this point.

1 Like

This was the exact answer I needed

I was having this issue when deploying a django app on a vps

uninstalling and reinstalling the oauth lib solved my problem


1 Like

I having the same issue, it bothered me for days。it work when i reinstall oauthlib .Thank you very much!