Error occured while upgrading v12 to v13

Hi, When I am trying to upgrade the v12 into v13 an error is occuring

# AttributeError

AttributeError: 'WebsiteSettings' object has no attribute 'hide_login'

## Traceback *(most recent call last)*

* #### File "/home/bench/frappe-bench/apps/frappe/frappe/app.py", line *54* , in `application`

init_request(request)

* #### File "/home/bench/frappe-bench/apps/frappe/frappe/app.py", line *121* , in `init_request`

raise frappe.SessionStopped('Session Stopped')

* During handling of the above exception, another exception occurred:

* #### File "/home/bench/frappe-bench/apps/frappe/frappe/website/render.py", line *49* , in `render`

data = render_page_by_language(path)

* #### File "/home/bench/frappe-bench/apps/frappe/frappe/website/render.py", line *178* , in `render_page_by_language`

return render_page(path)

* #### File "/home/bench/frappe-bench/apps/frappe/frappe/website/render.py", line *194* , in `render_page`

return build(path)

* #### File "/home/bench/frappe-bench/apps/frappe/frappe/website/render.py", line *201* , in `build`

return build_page(path)

* #### File "/home/bench/frappe-bench/apps/frappe/frappe/website/render.py", line *216* , in `build_page`

context = get_context(path)

* #### File "/home/bench/frappe-bench/apps/frappe/frappe/website/context.py", line *28* , in `get_context`

context = build_context(context)

* #### File "/home/bench/frappe-bench/apps/frappe/frappe/website/context.py", line *85* , in `build_context`

context.update(get_website_settings(context))

* #### File "/home/bench/frappe-bench/apps/frappe/frappe/website/doctype/website_settings/website_settings.py", line *160* , in `get_website_settings`

context["hide_login"] = settings.hide_login

* During handling of the above exception, another exception occurred:

* #### File "/home/bench/frappe-bench/apps/frappe/frappe/middlewares.py", line *16* , in `__call__`

return super(StaticDataMiddleware, self).__call__(environ, start_response)

* #### File "/home/bench/frappe-bench/env/lib/python3.8/site-packages/werkzeug/middleware/shared_data.py", line *220* , in `__call__`

return self.app(environ, start_response)

* #### File "/home/bench/frappe-bench/env/lib/python3.8/site-packages/werkzeug/middleware/shared_data.py", line *220* , in `__call__`

return self.app(environ, start_response)

* #### File "/home/bench/frappe-bench/env/lib/python3.8/site-packages/werkzeug/local.py", line *231* , in `application`

return ClosingIterator(app(environ, start_response), self.cleanup)

* #### File "/home/bench/frappe-bench/env/lib/python3.8/site-packages/werkzeug/wrappers/base_request.py", line *237* , in `application`

resp = f(*args[:-2] + (request,))

* #### File "/home/bench/frappe-bench/apps/frappe/frappe/app.py", line *86* , in `application`

response = frappe.utils.response.handle_session_stopped()

* #### File "/home/bench/frappe-bench/apps/frappe/frappe/utils/response.py", line *223* , in `handle_session_stopped`

return frappe.website.render.render("message", http_status_code=503)

* #### File "/home/bench/frappe-bench/apps/frappe/frappe/website/render.py", line *79* , in `render`

data = render_page(path)

* #### File "/home/bench/frappe-bench/apps/frappe/frappe/website/render.py", line *194* , in `render_page`

return build(path)

* #### File "/home/bench/frappe-bench/apps/frappe/frappe/website/render.py", line *201* , in `build`

return build_page(path)

* #### File "/home/bench/frappe-bench/apps/frappe/frappe/website/render.py", line *216* , in `build_page`

context = get_context(path)

* #### File "/home/bench/frappe-bench/apps/frappe/frappe/website/context.py", line *28* , in `get_context`

context = build_context(context)

* #### File "/home/bench/frappe-bench/apps/frappe/frappe/website/context.py", line *85* , in `build_context`

context.update(get_website_settings(context))

* #### File "/home/bench/frappe-bench/apps/frappe/frappe/website/doctype/website_settings/website_settings.py", line *160* , in `get_website_settings`

context["hide_login"] = settings.hide_login

> AttributeError: 'WebsiteSettings' object has no attribute 'hide_login'

The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error.

To switch between the interactive traceback and the plaintext one, you can click on the “Traceback” headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.

You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:

  • dump() shows all variables in the frame
  • dump(obj) dumps all that’s known about the object

Brought to you by DON’T PANIC , your friendly Werkzeug powered traceback interpreter.

How to resolve this issue?

1 Like

I believe this will work:

  1. Run bench console
  2. Enter the following code:
import frappe
frappe.reload_doc('website', 'doctype', 'Website Settings')
frappe.db.commit()

That should synchronize the Website Settings DocType, and allow you to continue.

I did this but got error:

bench@user-VirtualBox:~/frappe-bench$ bench console
Apps in this namespace:
frappe, erpnext

In [1]: import frappe

In [2]: import frappe
   ...: frappe.reload_doc('website', 'doctype', 'Website Settings')
   ...: frappe.db.commit()
---------------------------------------------------------------------------
ProgrammingError                          Traceback (most recent call last)
~/frappe-bench/apps/frappe/frappe/commands/utils.py in <module>
      1 import frappe
----> 2 frappe.reload_doc('website', 'doctype', 'Website Settings')
      3 frappe.db.commit()

~/frappe-bench/apps/frappe/frappe/__init__.py in reload_doc(module, dt, dn, force, reset_permissions)
    920 
    921         import frappe.modules
--> 922         return frappe.modules.reload_doc(module, dt, dn, force=force, reset_permissions=reset_permissions)
    923 
    924 @whitelist()

~/frappe-bench/apps/frappe/frappe/modules/utils.py in reload_doc(module, dt, dn, force, reset_permissions)
    173 def reload_doc(module, dt=None, dn=None, force=False, reset_permissions=False):
    174         from frappe.modules.import_file import import_files
--> 175         return import_files(module, dt, dn, force=force, reset_permissions=reset_permissions)
    176 
    177 def export_doc(doctype, name, module=None):

~/frappe-bench/apps/frappe/frappe/modules/import_file.py in import_files(module, dt, dn, force, pre_process, reset_permissions)
     28                 return out
     29         else:
---> 30 		return import_file(module, dt, dn, force=force, pre_process=pre_process,
     31 			reset_permissions=reset_permissions)
     32 

~/frappe-bench/apps/frappe/frappe/modules/import_file.py in import_file(module, dt, dn, force, pre_process, reset_permissions)
     34         """Sync a file from txt if modifed, return false if not updated"""
     35         path = get_file_path(module, dt, dn)
---> 36         ret = import_file_by_path(path, force, pre_process=pre_process, reset_permissions=reset_permissions)
     37         return ret
     38 

~/frappe-bench/apps/frappe/frappe/modules/import_file.py in import_file_by_path(path, force, data_import, pre_process, ignore_version, reset_permissions, for_sync)
     67 
     68                         frappe.flags.in_import = True
---> 69 			import_doc(doc, force=force, data_import=data_import, pre_process=pre_process,
     70 				ignore_version=ignore_version, reset_permissions=reset_permissions)
     71                         frappe.flags.in_import = False

~/frappe-bench/apps/frappe/frappe/modules/import_file.py in import_doc(docdict, force, data_import, pre_process, ignore_version, reset_permissions)
    106                 controller.prepare_for_import(docdict)
    107 
--> 108         doc = frappe.get_doc(docdict)
    109 
    110         # Note on Tree DocTypes:

~/frappe-bench/apps/frappe/frappe/__init__.py in get_doc(*args, **kwargs)
    848 	"""
    849         import frappe.model.document
--> 850         doc = frappe.model.document.get_doc(*args, **kwargs)
    851 
    852         # set in cache

~/frappe-bench/apps/frappe/frappe/model/document.py in get_doc(*args, **kwargs)
     72         controller = get_controller(doctype)
     73         if controller:
---> 74                 return controller(*args, **kwargs)
     75 
     76         raise ImportError(doctype)

~/frappe-bench/apps/frappe/frappe/model/document.py in __init__(self, *args, **kwargs)
    119                 if kwargs:
    120                         # init base document
--> 121                         super(Document, self).__init__(kwargs)
    122                         self.init_valid_columns()
    123 

~/frappe-bench/apps/frappe/frappe/model/base_document.py in __init__(self, d)
     80 
     81         def __init__(self, d):
---> 82                 self.update(d)
     83                 self.dont_update_if_missing = []
     84 

~/frappe-bench/apps/frappe/frappe/model/base_document.py in update(self, d)
    111 
    112                 for key, value in iteritems(d):
--> 113                         self.set(key, value)
    114 
    115                 return self

~/frappe-bench/apps/frappe/frappe/model/base_document.py in set(self, key, value, as_value)
    158                 if isinstance(value, list) and not as_value:
    159                         self.__dict__[key] = []
--> 160                         self.extend(key, value)
    161                 else:
    162                         self.__dict__[key] = value

~/frappe-bench/apps/frappe/frappe/model/base_document.py in extend(self, key, value)
    204                 if isinstance(value, list):
    205                         for v in value:
--> 206                                 self.append(key, v)
    207                 else:
    208                         raise ValueError

~/frappe-bench/apps/frappe/frappe/model/base_document.py in append(self, key, value)
    181                         if not self.__dict__.get(key):
    182                                 self.__dict__[key] = []
--> 183                         value = self._init_child(value, key)
    184                         self.__dict__[key].append(value)
    185 

~/frappe-bench/apps/frappe/frappe/model/base_document.py in _init_child(self, value, key)
    220                                         raise AttributeError(key)
    221 
--> 222                         value = get_controller(value["doctype"])(value)
    223                         value.init_valid_columns()
    224 

~/frappe-bench/apps/frappe/frappe/model/document.py in __init__(self, *args, **kwargs)
    120                         # init base document
    121                         super(Document, self).__init__(kwargs)
--> 122                         self.init_valid_columns()
    123 
    124                 else:

~/frappe-bench/apps/frappe/frappe/model/base_document.py in init_valid_columns(self)
    284                                 self.__dict__[key] = 0
    285 
--> 286                 for key in self.get_valid_columns():
    287                         if key not in self.__dict__:
    288                                 self.__dict__[key] = None

~/frappe-bench/apps/frappe/frappe/model/base_document.py in get_valid_columns(self)
    292                         if self.doctype in DOCTYPES_FOR_DOCTYPE:
    293                                 from frappe.model.meta import get_table_columns
--> 294                                 valid = get_table_columns(self.doctype)
    295                         else:
    296                                 valid = self.meta.get_valid_columns()

~/frappe-bench/apps/frappe/frappe/model/meta.py in get_table_columns(doctype)
     47 
     48 def get_table_columns(doctype):
---> 49         return frappe.db.get_table_columns(doctype)
     50 
     51 def load_doctype_from_file(doctype):

~/frappe-bench/apps/frappe/frappe/database/database.py in get_table_columns(self, doctype)
    894                 columns = self.get_db_table_columns('tab' + doctype)
    895                 if not columns:
--> 896                         raise self.TableMissingError('DocType', doctype)
    897                 return columns
    898 

ProgrammingError: ('DocType', 'DocType Action')

In [3]: frappe.reload_doc('website', 'doctype', 'Website Settings')
---------------------------------------------------------------------------
ProgrammingError                          Traceback (most recent call last)
~/frappe-bench/apps/frappe/frappe/commands/utils.py in <module>
----> 1 frappe.reload_doc('website', 'doctype', 'Website Settings')

~/frappe-bench/apps/frappe/frappe/__init__.py in reload_doc(module, dt, dn, force, reset_permissions)
    920 
    921         import frappe.modules
--> 922         return frappe.modules.reload_doc(module, dt, dn, force=force, reset_permissions=reset_permissions)
    923 
    924 @whitelist()

~/frappe-bench/apps/frappe/frappe/modules/utils.py in reload_doc(module, dt, dn, force, reset_permissions)
    173 def reload_doc(module, dt=None, dn=None, force=False, reset_permissions=False):
    174         from frappe.modules.import_file import import_files
--> 175         return import_files(module, dt, dn, force=force, reset_permissions=reset_permissions)
    176 
    177 def export_doc(doctype, name, module=None):

~/frappe-bench/apps/frappe/frappe/modules/import_file.py in import_files(module, dt, dn, force, pre_process, reset_permissions)
     28                 return out
     29         else:
---> 30 		return import_file(module, dt, dn, force=force, pre_process=pre_process,
     31 			reset_permissions=reset_permissions)
     32 

~/frappe-bench/apps/frappe/frappe/modules/import_file.py in import_file(module, dt, dn, force, pre_process, reset_permissions)
     34         """Sync a file from txt if modifed, return false if not updated"""
     35         path = get_file_path(module, dt, dn)
---> 36         ret = import_file_by_path(path, force, pre_process=pre_process, reset_permissions=reset_permissions)
     37         return ret
     38 

~/frappe-bench/apps/frappe/frappe/modules/import_file.py in import_file_by_path(path, force, data_import, pre_process, ignore_version, reset_permissions, for_sync)
     67 
     68                         frappe.flags.in_import = True
---> 69 			import_doc(doc, force=force, data_import=data_import, pre_process=pre_process,
     70 				ignore_version=ignore_version, reset_permissions=reset_permissions)
     71                         frappe.flags.in_import = False

~/frappe-bench/apps/frappe/frappe/modules/import_file.py in import_doc(docdict, force, data_import, pre_process, ignore_version, reset_permissions)
    106                 controller.prepare_for_import(docdict)
    107 
--> 108         doc = frappe.get_doc(docdict)
    109 
    110         # Note on Tree DocTypes:

~/frappe-bench/apps/frappe/frappe/__init__.py in get_doc(*args, **kwargs)
    848 	"""
    849         import frappe.model.document
--> 850         doc = frappe.model.document.get_doc(*args, **kwargs)
    851 
    852         # set in cache

~/frappe-bench/apps/frappe/frappe/model/document.py in get_doc(*args, **kwargs)
     72         controller = get_controller(doctype)
     73         if controller:
---> 74                 return controller(*args, **kwargs)
     75 
     76         raise ImportError(doctype)

~/frappe-bench/apps/frappe/frappe/model/document.py in __init__(self, *args, **kwargs)
    119                 if kwargs:
    120                         # init base document
--> 121                         super(Document, self).__init__(kwargs)
    122                         self.init_valid_columns()
    123 

~/frappe-bench/apps/frappe/frappe/model/base_document.py in __init__(self, d)
     80 
     81         def __init__(self, d):
---> 82                 self.update(d)
     83                 self.dont_update_if_missing = []
     84 

~/frappe-bench/apps/frappe/frappe/model/base_document.py in update(self, d)
    111 
    112                 for key, value in iteritems(d):
--> 113                         self.set(key, value)
    114 
    115                 return self

~/frappe-bench/apps/frappe/frappe/model/base_document.py in set(self, key, value, as_value)
    158                 if isinstance(value, list) and not as_value:
    159                         self.__dict__[key] = []
--> 160                         self.extend(key, value)
    161                 else:
    162                         self.__dict__[key] = value

~/frappe-bench/apps/frappe/frappe/model/base_document.py in extend(self, key, value)
    204                 if isinstance(value, list):
    205                         for v in value:
--> 206                                 self.append(key, v)
    207                 else:
    208                         raise ValueError

~/frappe-bench/apps/frappe/frappe/model/base_document.py in append(self, key, value)
    181                         if not self.__dict__.get(key):
    182                                 self.__dict__[key] = []
--> 183                         value = self._init_child(value, key)
    184                         self.__dict__[key].append(value)
    185 

~/frappe-bench/apps/frappe/frappe/model/base_document.py in _init_child(self, value, key)
    220                                         raise AttributeError(key)
    221 
--> 222                         value = get_controller(value["doctype"])(value)
    223                         value.init_valid_columns()
    224 

~/frappe-bench/apps/frappe/frappe/model/document.py in __init__(self, *args, **kwargs)
    120                         # init base document
    121                         super(Document, self).__init__(kwargs)
--> 122                         self.init_valid_columns()
    123 
    124                 else:

~/frappe-bench/apps/frappe/frappe/model/base_document.py in init_valid_columns(self)
    284                                 self.__dict__[key] = 0
    285 
--> 286                 for key in self.get_valid_columns():
    287                         if key not in self.__dict__:
    288                                 self.__dict__[key] = None

~/frappe-bench/apps/frappe/frappe/model/base_document.py in get_valid_columns(self)
    292                         if self.doctype in DOCTYPES_FOR_DOCTYPE:
    293                                 from frappe.model.meta import get_table_columns
--> 294                                 valid = get_table_columns(self.doctype)
    295                         else:
    296                                 valid = self.meta.get_valid_columns()

~/frappe-bench/apps/frappe/frappe/model/meta.py in get_table_columns(doctype)
     47 
     48 def get_table_columns(doctype):
---> 49         return frappe.db.get_table_columns(doctype)
     50 
     51 def load_doctype_from_file(doctype):

~/frappe-bench/apps/frappe/frappe/database/database.py in get_table_columns(self, doctype)
    894                 columns = self.get_db_table_columns('tab' + doctype)
    895                 if not columns:
--> 896                         raise self.TableMissingError('DocType', doctype)
    897                 return columns
    898 

ProgrammingError: ('DocType', 'DocType Action')

I’m also facing the same issue .Not able to solve using the solution you suggested.

Try this

1 Like

The following command worked for me :smiley:

bench update --patch