chat icon indicating copy to clipboard operation
chat copied to clipboard

AttributeError: type object 'datetime.time' has no attribute 'fromisoformat'

Open aditsanghvi opened this issue 3 years ago • 5 comments

running this error after installing it to my site

ubuntu version 18.04 python3 version 3.6.9

App Versions

{
	"chat": "0.0.1",
	"erpnext": "13.17.0",
	"frappe": "13.17.1"
}

Route

Workspaces/Home

Trackeback

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 68, in application
    response = frappe.api.handle()
  File "apps/frappe/frappe/api.py", line 55, in handle
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 31, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 67, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1208, in call
    return fn(*args, **newargs)
  File "apps/chat/chat/api/config.py", line 22, in settings
    config = {**config, **get_chat_settings()}
  File "apps/chat/chat/utils/__init__.py", line 97, in get_chat_settings
    start_time = datetime.time.fromisoformat(chat_settings.start_time)
AttributeError: type object 'datetime.time' has no attribute 'fromisoformat'

Request Data

{
	"type": "GET",
	"args": {
		"token": ""
	},
	"headers": {},
	"error_handlers": {},
	"url": "/api/method/chat.api.config.settings"
}

Response Data

{
	"exception": "AttributeError: type object 'datetime.time' has no attribute 'fromisoformat'"
}

aditsanghvi avatar Dec 26 '21 08:12 aditsanghvi

python3 version 3.6.9

the datetime.time.fromisoformat is not available in python < 3.7, as mentioned in their docs

can you please try upgrading the python version?

phot0n avatar Jan 06 '22 19:01 phot0n

After Updating python to 3.7, my bench framework stop stops wroking and when I downgrade back to 3.6.9 my bench framework starts working again

aditsanghvi avatar Jan 10 '22 08:01 aditsanghvi

@phot0n we technically support 3.6 on version 13 so it has to be fixed 😅

@aditsanghvi I am not sure how you've upgraded the version. Upgrading bench's version also requires swapping env (virtualenvironment)

ankush avatar Jan 10 '22 08:01 ankush

https://github.com/frappe/chat/pull/34

bhavesh95863 avatar Jun 08 '22 13:06 bhavesh95863

you can use datetime.strptime(chat_settings.start_time,"specify_format")

ParasKumarGupta avatar Mar 07 '23 07:03 ParasKumarGupta