Error while installing ERPNext app on bench in dockerized development set up AttributeError: 'NoneType' object has no attribute 'options'

Fellow community members,

Can you please help in resolving my issue?
@revant_one

ddavidebor

My environment:
OS: Windows 10 Pro
Docker: Docker Desktop
Editor/IDE: Visual Studio Code-Insiders
I followed all the steps diligently from this link : frappe_docker/README.md at main · frappe/frappe_docker · GitHub.
I also referred to : Frappe_docker Getting started OSError: setuptools pip wheel failed with error code 1 - #3 by Osam
and Test images on Windows · Issue #137 · frappe/frappe_docker · GitHub

All the steps perfect until the last step of installing custom app. I tried Erpnext app : bench get-app erpnext GitHub - frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP) – Worked fine.
bench --site mysite.localhost install-app erpnext – This is where I got the errors.

frappe@d0badfa2ce18:/workspace/development/frappe-bench$ bench --site latsite.localhost install-app erpnext
Installing erpnext…
Updating DocTypes for erpnext : [======================= ]Traceback (most recent call last):
File “/usr/lib/python3.7/runpy.py”, line 193, in _run_module_as_main
main”, mod_spec)
File “/usr/lib/python3.7/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/workspace/development/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 97, in
main()
File “/workspace/development/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/workspace/development/frappe-bench/env/lib/python3.7/site-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/workspace/development/frappe-bench/env/lib/python3.7/site-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/workspace/development/frappe-bench/env/lib/python3.7/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/workspace/development/frappe-bench/env/lib/python3.7/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/workspace/development/frappe-bench/env/lib/python3.7/site-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/workspace/development/frappe-bench/env/lib/python3.7/site-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/workspace/development/frappe-bench/env/lib/python3.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/workspace/development/frappe-bench/apps/frappe/frappe/commands/init.py”, line 25, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/workspace/development/frappe-bench/apps/frappe/frappe/commands/site.py”, line 179, in install_app
_install_app(app, verbose=context.verbose)
File “/workspace/development/frappe-bench/apps/frappe/frappe/installer.py”, line 83, in install_app
sync_for(name, force=True, sync_everything=True, verbose=verbose, reset_permissions=True)
File “/workspace/development/frappe-bench/apps/frappe/frappe/model/sync.py”, line 56, in sync_for
reset_permissions=reset_permissions, for_sync=True)
File “/workspace/development/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 66, in import_file_by_path
ignore_version=ignore_version, reset_permissions=reset_permissions)
File “/workspace/development/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 106, in import_doc
doc = frappe.get_doc(docdict)
File “/workspace/development/frappe-bench/apps/frappe/frappe/init.py”, line 753, in get_doc
doc = frappe.model.document.get_doc(*args, **kwargs)
File “/workspace/development/frappe-bench/apps/frappe/frappe/model/document.py”, line 71, in get_doc
return controller(*args, **kwargs)
File “/workspace/development/frappe-bench/apps/frappe/frappe/model/document.py”, line 115, in init
super(Document, self).init(kwargs)
File “/workspace/development/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 65, in init
self.update(d)
File “/workspace/development/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 88, in update
self.set(key, value)
File “/workspace/development/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 135, in set
self.extend(key, value)
File “/workspace/development/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 172, in extend
self.append(key, v)
File “/workspace/development/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 149, in append
value = self._init_child(value, key)
File “/workspace/development/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 184, in _init_child
value[“doctype”] = self.get_table_field_doctype(key)
File “/workspace/development/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 298, in get_table_field_doctype
return self.meta.get_field(fieldname).options
AttributeError: ‘NoneType’ object has no attribute ‘options’
frappe@d0badfa2ce18:/workspace/development/frappe-bench$

Needless to say, I’m Frappe/ERPNext newbee :slight_smile:

I checked tabDocField table, and I see some values. Also, see there is a column name “Options”.
On side note, can someone please suggest how to connect to mysql instance inside this container from mysql workbench? I tried, localhost and also tried to set host as % as root as well as new user. But, failed to connect from mysql work bench.

I’m not able to replicate this.

  • if bench is init without specifying --frappe-branch it installs frappe on develop branch. refer: bench init --help
  • if get-app doesn’t specify --branch it gets develop branch. refer bench get-app --help
  • both frappe and erpnext must be on branch with same name. e.g. version-12

edit .devcontainers/docker-compose.yml. you need to publish mariadb ports to host.
If on windows and using docker-machine, you will need to find out how to connect mysql workbench to docker machine instead of localhost

1 Like

Thanks alot, @revant_one for your reply.

Your suggestion on how to connect from mysql workbench worked like a charm!

Blockquote edit .devcontainers/docker-compose.yml . you need to publish mariadb ports to host.
If on windows and using docker-machine, you will need to find out how to connect mysql workbench to docker machine instead of localhost

As you suggested, after I published mariadb ports to host, it worked perfectly . I’m on windows 10 pro and using docker desktop. Effectively, everything points to localhost. There was no need to find docker-machine ip.

Thanks a lot @revant_one

This pointer too nailed the problem precisely. I’m not sure why there is mismatch of branch versions in instructions at : https://github.com/frappe/frappe_docker/blob/develop/development/README.md

I’ve put pull request suggesting the change in user guide. Request you to check.

1 Like

PR is merged.
Thanks for the fix!