I'm using 

https://github.com/ValvePython/steam
https://github.com/django/channels

and I'm trying to make them work together. Problem is that when SteamClient 
starts I cannot send any message with channels.

Group(group_name).send({
   'text': json.dumps({
         'match_status': "balancing teams",
    }),
})

This won't ever send message until SteamClient is running unless I put it 
to new thread. But when i do that I end up with: 


> gevent.hub.LoopExit: ('This operation would block forever', <Hub at 
> 0x7fc465aabd58 epoll pending=0 ref=0 fileno=27>)



Example of my code:

@client.on('logged_on')
    def start_dota():
        Group(group_name).send({
            'text': json.dumps({
                    'bot': getSteamProfile(str(client.steam_id)),
             }),
         })

        dota.launch()
        dota.wait_event('lobby_removed')

I'm trying to solve this for month already and I still cannot find out how. 
I just want to run gevent based SteamClient after i call it from main 
thread. I tried a lot, run it as new process, thread, for example:

p = Thread(target=start_bot, args=(kwargs['instance'].match_id, group1, 
group2,group_name, rad_reward, dire_reward, team1, team2, ))
p.start()

When I start it as new thread I also get end up with gevent.hub.LoopExit: 
('This operation would block forever', ........

or

start_bot(kwargs['instance'].match_id, group1, group2,group_name, 
rad_reward, dire_reward, team1, team2)

this doesn't send channels messages at all.

Could anyone help me to solve this puzzle? I'm desperate.


-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f6c574c4-3449-4d95-be78-2db3451fcc3a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to