Error when "bench update" . stuck here [[help]]: TypeError: unsupported operand type(s) for |: ‘type’ and ‘NoneType’

I tried to update bench and keeps on getting this error .stuck here
Traceback (most recent call last):
File “/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/runpy.py”, line 185, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File “/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/runpy.py”, line 111, in _get_module_details
import(pkg_name)
File “/Users/anjan/Documents/Dev/frappe-bench1/apps/frappe/frappe/init.py”, line 25, in
from frappe.query_builder import get_query_builder, patch_query_aggregation, patch_query_execute
File “/Users/anjan/Documents/Dev/frappe-bench1/apps/frappe/frappe/query_builder/init.py”, line 6, in
from frappe.query_builder.terms import ParameterizedFunction, ParameterizedValueWrapper
File “/Users/anjan/Documents/Dev/frappe-bench1/apps/frappe/frappe/query_builder/terms.py”, line 8, in
from frappe.utils.data import format_timedelta
File “/Users/anjan/Documents/Dev/frappe-bench1/apps/frappe/frappe/utils/init.py”, line 25, in
from frappe.utils.data import *
File “/Users/anjan/Documents/Dev/frappe-bench1/apps/frappe/frappe/utils/data.py”, line 75, in
def getdate(string_date: Optional[“DateTimeLikeObject”] = None) → datetime.date | None:
TypeError: unsupported operand type(s) for |: ‘type’ and ‘NoneType’

Bench command cache doesn’t exist in this folder!
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
From GitHub - frappe/frappe: Low code web framework for real world applications, in Python and Javascript

  • branch develop → FETCH_HEAD
    WARN: shallow_clone is set in your bench config.
    However without passing the --reset flag, your repositories will be unshallowed.
    To avoid this, cancel this operation and run bench update --reset.

Consider the consequences of git reset --hard on your apps before you run that.
To avoid seeing this warning, set shallow_clone to false in your common_site_config.json

Backing up sites…
Traceback (most recent call last):
File “/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/runpy.py”, line 185, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File “/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/runpy.py”, line 111, in _get_module_details
import(pkg_name)
File “/Users/anjan/Documents/Dev/frappe-bench1/apps/frappe/frappe/init.py”, line 25, in
from frappe.query_builder import get_query_builder, patch_query_aggregation, patch_query_execute
File “/Users/anjan/Documents/Dev/frappe-bench1/apps/frappe/frappe/query_builder/init.py”, line 6, in
from frappe.query_builder.terms import ParameterizedFunction, ParameterizedValueWrapper
File “/Users/anjan/Documents/Dev/frappe-bench1/apps/frappe/frappe/query_builder/terms.py”, line 8, in
from frappe.utils.data import format_timedelta
File “/Users/anjan/Documents/Dev/frappe-bench1/apps/frappe/frappe/utils/init.py”, line 25, in
from frappe.utils.data import *
File “/Users/anjan/Documents/Dev/frappe-bench1/apps/frappe/frappe/utils/data.py”, line 75, in
def getdate(string_date: Optional[“DateTimeLikeObject”] = None) → datetime.date | None:
TypeError: unsupported operand type(s) for |: ‘type’ and ‘NoneType’

What version are ERPNext and Frappe on ?

hi @centaur ,
i tried bench version and it is also giving me errors . i will put the screenshot below.frappe version is 5.8.1

Hmm

If you are on the develop branch the minimum required version of python has been upped to 3.10

There was breaking changes here
https://github.com/frappe/frappe/commit/d7789ab6ff8ee19905a34148a0022ee9b0b320b8

and a revert here as well

https://github.com/frappe/frappe/commit/261fbfcd111b19a351d98b4cc8912587a2b7778f

If you are on develop you could do a bench update --reset and try

bench update --reset also gives the same error @centaur