Hi guys, 

I am getting an error in a program which is using threading to perform 
functions simultaneously, this process is a  job which is run once per 
hour, The data that comes in is from a view in sql.

The function that we call in target arg returns a dictionary and says 
"dict object is not callable".
Inside the function , we return a dictionary in the end.
My doubt is what should we return in this function ..if I dont return 
anything will it affect any other thread??

what my code looks like :
inside the jobs in django I call this function


def ticket_booking():  
  
    query = " SELECT * FROM vw_ticket_list;"  

    ttd = []
    try:
        result = query_to_dicts(query)
        tickets = json.loads(to_json(result))
        if tickets:
            # Calling the vaccination push message (php).
            for ticket in tickets:
            
                # Getting Generic details used by all categories
                full_name = tickets['full_name'] 
                gender = tickets['gender']  
                email =tickets[email]

                if tickets['language_id'] == 1:  #book english movie 
tickets 
                   
                    # Calling the function inside the Thread for a 
Syncronuz Call (Wait and Watch)
                    myThread = threading.Thread(target=book_english(email, 
full_name))
                    myThread.start()  
                    myThread.join()  

                if tickets['language_id']  == 2:  # book italian movie 
tickets 
                    myThread = threading.Thread(target=book_italian( email, 
full_name, gender))
                    myThread.start()  # Starting the Thread
                    myThread.join() #Will return here if sth is returned

as you can see in code comments ..if book italian function returns sth , 
only then it can return here and I have 5 threads in total to excute 
simultaneously...book italian function is like :

def book_italian(email,fullname,gender):
try
    ###posts data to another server #
    b=requests.post(some postdata)

     a =log.objects.create(log data from b in crct format)
     return a--->{"Message":"Log created successfully"}

a is type class dict and I tried to change it to many types still gives me 
same error
any suggestions or alternatives,workarounds are welcome, this job is not 
running when run in crontab.

Thanks in advance.




-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f854bcd9-4ba7-4e4f-b415-8967f253c19cn%40googlegroups.com.

Reply via email to