Scheduler Error: Cannot import name strip

After performing bench update to the latest v4 version the system admin receives a scheduler error email. Anyone knows why this is so?

Method: all, Handler: erpnext.support.doctype.supportticket.getsupportmails.getsupportmails Traceback (innermost last): File “/home/erpnext/frappe-bench/apps/frappe/frappe/tasks.py”, line 77, in schedulertask frappe.getattr(handler)() File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 519, in getattr methodname = methodstring.split(‘.’)[-1] File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 379, in getmodule return importlib.importmodule(modulename) File “/usr/lib/python2.7/importlib/init.py”, line 37, in importmodule import(name) File “/home/erpnext/frappe-bench/apps/erpnext/erpnext/support/doctype/supportticket/getsupportmails.py”, line 7, in File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/emaillib/init.py”, line 7, in from frappe.utils.emaillib.emailbody import getemail File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/emaillib/emailbody.py”, line 7, in from frappe.utils import scruburls, geturl, strip ImportError: cannot import name strip

Time: 2015-03-22 12:59:51.771106

Method: frappe.utils.emaillib.bulk.flush
Method: all, Handler: frappe.utils.emaillib.bulk.flush
Traceback (innermost last):
File “/home/erpnext/frappe-bench/apps/frappe/frappe/tasks.py”, line 77, in schedulertask
frappe.getattr(handler)()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 519, in getattr
methodname = methodstring.split(‘.’)[-1]
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 379, in getmodule
return importlib.importmodule(modulename)
File “/usr/lib/python2.7/importlib/init.py”, line 37, in importmodule
import(name)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/emaillib/init.py”, line 7, in
from frappe.utils.emaillib.emailbody import getemail
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/emaillib/emailbody.py”, line 7, in
from frappe.utils import scruburls, geturl, strip
ImportError: cannot import name strip
Time: 2015-03-22 12:59:51.775588

Method: erpnext.selling.doctype.lead.getleads.getleads
Method: all, Handler: erpnext.selling.doctype.lead.getleads.getleads
Traceback (innermost last):
File “/home/erpnext/frappe-bench/apps/frappe/frappe/tasks.py”, line 77, in schedulertask
frappe.getattr(handler)()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 519, in getattr
methodname = methodstring.split(‘.’)[-1]
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 379, in getmodule
return importlib.importmodule(modulename)
File “/usr/lib/python2.7/importlib/init.py”, line 37, in importmodule
import(name)
File “/home/erpnext/frappe-bench/apps/erpnext/erpnext/selling/doctype/lead/getleads.py”, line 7, in
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/emaillib/init.py”, line 7, in
from frappe.utils.emaillib.emailbody import getemail
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/emaillib/emailbody.py”, line 7, in
from frappe.utils import scruburls, geturl, strip
ImportError: cannot import name strip
Time: 2015-03-22 12:59:51.803690

Method: erpnext.hr.doctype.jobapplicant.getjobapplications.getjobapplications
Method: all, Handler: erpnext.hr.doctype.jobapplicant.getjobapplications.getjobapplications
Traceback (innermost last):
File “/home/erpnext/frappe-bench/apps/frappe/frappe/tasks.py”, line 77, in schedulertask
frappe.getattr(handler)()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 519, in getattr
methodname = methodstring.split(‘.’)[-1]
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 379, in getmodule
return importlib.importmodule(modulename)
File “/usr/lib/python2.7/importlib/init.py”, line 37, in importmodule
import(name)
File “/home/erpnext/frappe-bench/apps/erpnext/erpnext/hr/doctype/jobapplicant/getjobapplications.py”, line 7, in
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/emaillib/init.py”, line 7, in
from frappe.utils.emaillib.emailbody import getemail
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/emaillib/emailbody.py”, line 7, in
from frappe.utils import scruburls, geturl, strip
ImportError: cannot import name strip
Time: 2015-03-22 13:04:51.769088

Method: frappe.utils.emaillib.bulk.flush
Method: all, Handler: frappe.utils.emaillib.bulk.flush
Traceback (innermost last):
File “/home/erpnext/frappe-bench/apps/frappe/frappe/tasks.py”, line 77, in schedulertask
frappe.getattr(handler)()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 519, in getattr
methodname = methodstring.split(‘.’)[-1]
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 379, in getmodule
return importlib.importmodule(modulename)
File “/usr/lib/python2.7/importlib/init.py”, line 37, in importmodule
import(name)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/emaillib/init.py”, line 7, in
from frappe.utils.emaillib.emailbody import getemail
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/emaillib/emailbody.py”, line 7, in
from frappe.utils import scruburls, geturl, strip
ImportError: cannot import name strip
Time: 2015-03-22 13:04:51.776902

Method: erpnext.support.doctype.supportticket.getsupportmails.getsupportmails
Method: all, Handler: erpnext.support.doctype.supportticket.getsupportmails.getsupportmails
Traceback (innermost last):
File “/home/erpnext/frappe-bench/apps/frappe/frappe/tasks.py”, line 77, in schedulertask
frappe.getattr(handler)()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 519, in getattr
methodname = methodstring.split(‘.’)[-1]
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 379, in getmodule
return importlib.importmodule(modulename)
File “/usr/lib/python2.7/importlib/init.py”, line 37, in importmodule
import(name)
File “/home/erpnext/frappe-bench/apps/erpnext/erpnext/support/doctype/supportticket/getsupportmails.py”, line 7, in
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/emaillib/init.py”, line 7, in
from frappe.utils.emaillib.emailbody import getemail
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/emaillib/emailbody.py”, line 7, in
from frappe.utils import scruburls, geturl, strip
ImportError: cannot import name strip
Time: 2015-03-22 13:04:51.798725

Method: erpnext.hr.doctype.jobapplicant.getjobapplications.getjobapplications
Method: all, Handler: erpnext.hr.doctype.jobapplicant.getjobapplications.getjobapplications
Traceback (innermost last):
File “/home/erpnext/frappe-bench/apps/frappe/frappe/tasks.py”, line 77, in schedulertask
frappe.getattr(handler)()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 519, in getattr
methodname = methodstring.split(‘.’)[-1]
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 379, in getmodule
return importlib.importmodule(modulename)
File “/usr/lib/python2.7/importlib/init.py”, line 37, in importmodule
import(name)
File “/home/erpnext/frappe-bench/apps/erpnext/erpnext/hr/doctype/jobapplicant/getjobapplications.py”, line 7, in
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/emaillib/init.py”, line 7, in
from frappe.utils.emaillib.emailbody import getemail
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/emaillib/emailbody.py”, line 7, in
from frappe.utils import scruburls, geturl, strip
ImportError: cannot import name strip
Time: 2015-03-22 13:04:51.810510

Method: erpnext.selling.doctype.lead.getleads.getleads
Method: all, Handler: erpnext.selling.doctype.lead.getleads.getleads
Traceback (innermost last):
File “/home/erpnext/frappe-bench/apps/frappe/frappe/tasks.py”, line 77, in schedulertask
frappe.getattr(handler)()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 519, in getattr
methodname = methodstring.split(‘.’)[-1]
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 379, in getmodule
return importlib.importmodule(modulename)
File “/usr/lib/python2.7/importlib/init.py”, line 37, in importmodule
import(name)
File “/home/erpnext/frappe-bench/apps/erpnext/erpnext/selling/doctype/lead/getleads.py”, line 7, in
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/emaillib/init.py”, line 7, in
from frappe.utils.emaillib.emailbody import getemail
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/emaillib/emailbody.py”, line 7, in
from frappe.utils import scruburls, geturl, strip
ImportError: cannot import name strip
Time: 2015-03-22 13:24:52.062350

Method: frappe.utils.emaillib.bulk.flush
Method: all, Handler: frappe.utils.emaillib.bulk.flush
Traceback (innermost last):
File “/home/erpnext/frappe-bench/apps/frappe/frappe/tasks.py”, line 77, in schedulertask
frappe.getattr(handler)()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 519, in getattr
methodname = methodstring.split(‘.’)[-1]
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 379, in getmodule
return importlib.importmodule(modulename)
File “/usr/lib/python2.7/importlib/init.py”, line 37, in importmodule
import(name)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/emaillib/init.py”, line 7, in
from frappe.utils.emaillib.emailbody import getemail
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/emaillib/emailbody.py”, line 7, in
from frappe.utils import scruburls, geturl, strip
ImportError: cannot import name strip
Time: 2015-03-22 13:24:52.079698

Method: erpnext.support.doctype.supportticket.getsupportmails.getsupportmails
Method: all, Handler: erpnext.support.doctype.supportticket.getsupportmails.getsupportmails
Traceback (innermost last):
File “/home/erpnext/frappe-bench/apps/frappe/frappe/tasks.py”, line 77, in schedulertask
frappe.getattr(handler)()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 519, in getattr
methodname = methodstring.split(‘.’)[-1]
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 379, in getmodule
return importlib.importmodule(modulename)
File “/usr/lib/python2.7/importlib/init.py”, line 37, in importmodule
import(name)
File “/home/erpnext/frappe-bench/apps/erpnext/erpnext/support/doctype/supportticket/getsupportmails.py”, line 7, in
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/emaillib/init.py”, line 7, in
from frappe.utils.emaillib.emailbody import getemail
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/emaillib/emailbody.py”, line 7, in
from frappe.utils import scruburls, geturl, strip
ImportError: cannot import name strip

We are unable to replicate this… can you check again?

I did not receive any scheduler email errors today. Does the scheduler run daily?

Yeah it does. Are you running the production setup? Check your worker_log

Yes I am running production setup. I checked worker.error.log and only for that one particular day was it filled with this “cannot import name strip” error. It has since been suppressed without doing anything.

However, and I am not sure if it is related but my worker.error.log is filled with this error message that comes up every few minutes, any idea what this is?:

LockTimeoutError: ./erp_accurate/locks/scheduler.lock
[2015-04-03 17:46:47,502: ERROR/MainProcess] Task frappe.tasks.enqueue_events_for_site[452c0eb6-d3cb-4ee9-9f50-47921c5b4f40] raised unexpected: LockTimeoutError(u’./erp_accurate/locks/scheduler.lock’,)
Traceback (most recent call last):
File “/home/strella/frappe-bench/env/local/lib/python2.7/site-packages/celery/app/trace.py”, line 240, in trace_task
R = retval = fun(*args, **kwargs)
File “/home/strella/frappe-bench/env/local/lib/python2.7/site-packages/celery/app/trace.py”, line 437, in protected_call
return self.run(*args, **kwargs)
File “/home/strella/frappe-bench/apps/frappe/frappe/tasks.py”, line 108, in enqueue_events_for_site
enqueue_events(site)
File “/home/strella/frappe-bench/apps/frappe/frappe/utils/scheduler.py”, line 25, in enqueue_events
lock = create_lock(‘scheduler’)
File “/home/strella/frappe-bench/apps/frappe/frappe/utils/file_lock.py”, line 16, in create_lock
if not check_lock(lock_path):
File “/home/strella/frappe-bench/apps/frappe/frappe/utils/file_lock.py”, line 25, in check_lock
raise LockTimeoutError(path)
LockTimeoutError: ./erp_accurate/locks/scheduler.lock

Seems like your scheduler has stopped due errors.

Remove the bench/sites/[sitename]/locks/scheduler.lock file

Thanks for this. Seems to have been ok after i removed it and bench updated.