client is not able to connect to deluge daemon on localhost

Suggestions and discussion of future versions
Post Reply
ddhariwal

client is not able to connect to deluge daemon on localhost

Post by ddhariwal »

i Johny,

I am new to deluge and needed urgent help with it. I am running deluged -d as daemon and then I run the following code to connect

Code: Select all

from datetime import datetime
from deluge.common import ftime, fsize, fspeed
from deluge.ui.client import client
from twisted.internet import reactor
from optparse import OptionParser
import codecs
import logging
import os
import sys
# Set up the logger to print out errors
from deluge.log import setupLogger
setupLogger()


class DelugeInfo:
    uri = None
    options = None
    sessionstate = None
    sessionstatefound = False

    STATE_DOWNLOADING = 4
    STATE_SEEDING = 3
    STATE_QUEUED = 2
    STATE_PAUSED = 1
    STATE_UNKNOWN = 0


    def __init__(self, options):
        self.options = options
        d = client.connect()
        print d
        d.addCallback(self.on_connect_success)
        d.addErrback(self.on_connect_fail)
        reactor.run()


    def on_connect_success(result):
        print "connected"
        print "result: ", result
        client.disconnect()
        reactor.stop()

    def on_connect_fail(result):
        print "failed"
        print "result: ", result
        reactor.stop()
        pass

def main():
    options = None
    delugeInfo = DelugeInfo(options)

But I see that my reactor just runs and returns no result. I just get a deffered object thats it.
Post Reply