Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

raise TypeError('func must be callable') #49

Closed
agronholm opened this issue May 8, 2014 · 2 comments
Closed

raise TypeError('func must be callable') #49

agronholm opened this issue May 8, 2014 · 2 comments

Comments

@agronholm
Copy link
Owner

Originally reported by: webus (Bitbucket: webus, GitHub: webus)


I'm using 2.1.2 version of library

#!python

def send_mail_job(job_dic):
    mail_theme = job_dic['mail_theme']
    mail_body = job_dic['mail_body']
    mail_from = job_dic['mail_from']
    mail_to = job_dic['mail_to']

sched = Scheduler()
sched.start()
job_dic = {}
job_dic['mail_theme'] = ""
job_dic['mail_body'] = ""
job_dic['mail_from'] = ""
job_dic['mail_to'] = ""
start_date = datetime(
                    task.start_date.year,
                    task.start_date.month,
                    task.start_date.day,
                    task.start_date.hour,
                    task.start_date.minute,
                    task.start_date.second)
job = sched.add_job(patent_send_mail_job, 'simple', [start_date], [job_dic])

What is the magic error ? I just want to run job by my datetime data

#!bash

Traceback (most recent call last):                                                                                                     
  File "/home/wbs/.virtualenvs/patent/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 115, in get_response       
    response = callback(request, *callback_args, **callback_kwargs)                                                                    
  File "/home/wbs/.virtualenvs/patent/local/lib/python2.7/site-packages/django/views/generic/base.py", line 68, in view                
    return self.dispatch(request, *args, **kwargs)                                                                                     
  File "/home/wbs/.virtualenvs/patent/local/lib/python2.7/site-packages/braces/views/_access.py", line 64, in dispatch                 
    request, *args, **kwargs)                                                                                                          
  File "/home/wbs/.virtualenvs/patent/local/lib/python2.7/site-packages/django/views/generic/base.py", line 86, in dispatch            
    return handler(request, *args, **kwargs)                                                                                           
  File "/home/wbs/.virtualenvs/patent/local/lib/python2.7/site-packages/django/views/generic/edit.py", line 222, in post               
    return super(BaseUpdateView, self).post(request, *args, **kwargs)                                                                  
  File "/home/wbs/.virtualenvs/patent/local/lib/python2.7/site-packages/django/views/generic/edit.py", line 165, in post               
    return self.form_valid(form)                                                                                                       
  File "/home/wbs/.virtualenvs/patent/local/lib/python2.7/site-packages/django/views/generic/edit.py", line 127, in form_valid         
    self.object = form.save()                                                                                                          
  File "/home/wbs/.virtualenvs/patent/local/lib/python2.7/site-packages/django/forms/models.py", line 370, in save                     
    fail_message, commit, construct=False)                                                                                             
  File "/home/wbs/.virtualenvs/patent/local/lib/python2.7/site-packages/django/forms/models.py", line 87, in save_instance             
    instance.save()                                                                                                                    
  File "/home/wbs/.virtualenvs/patent/local/lib/python2.7/site-packages/django/db/models/base.py", line 546, in save                   
    force_update=force_update, update_fields=update_fields)                                                                            
  File "/home/wbs/.virtualenvs/patent/local/lib/python2.7/site-packages/django/db/models/base.py", line 664, in save_base              
    update_fields=update_fields, raw=raw, using=using)                                                                                 
  File "/home/wbs/.virtualenvs/patent/local/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 170, in send              
    response = receiver(signal=self, sender=sender, **named)                                                                           
  File "/home/wbs/src/work/patent/patent/patent_tasks/tasks.py", line 59, in update_task_list_on_new_task                              │
    job = sched.add_job(patent_send_mail_job, 'simple', [start_date], [job_dic])                                                       
  File "/home/wbs/.virtualenvs/patent/local/lib/python2.7/site-packages/apscheduler/scheduler.py", line 284, in add_job               
    options.pop('coalesce', self.coalesce), **options)                                                                                 
  File "/home/wbs/.virtualenvs/patent/local/lib/python2.7/site-packages/apscheduler/job.py", line 47, in __init__ 
    raise TypeError('func must be callable')                                                                                           
TypeError: func must be callable           

@agronholm
Copy link
Owner Author

Original comment by Alex Grönholm (Bitbucket: agronholm, GitHub: agronholm):


So where have you defined patent_send_mail_job? I can't see it in the code you pasted.

@agronholm
Copy link
Owner Author

Original comment by Alex Grönholm (Bitbucket: agronholm, GitHub: agronholm):


Closing as invalid since no further details were provided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant