4

これは、Deluge API と対話するためのdev.deluge-torrent.orgの簡単なサンプル スクリプトです。

reactor.run() の後に何も起こらず、「接続に成功しました」というメッセージが表示されず、永久にハングします。

これをUbuntuマシンで実行すると正常に動作しましたが、実際に使用したいWindowsマシンで動作させることができませんでした。

from deluge.ui.client import client
# Import the reactor module from Twisted - this is for our mainloop
from twisted.internet import reactor

# Set up the logger to print out errors
from deluge.log import setupLogger
setupLogger()

# Connect to a daemon running on the localhost
# We get a Deferred object from this method and we use this to know if and when
# the connection succeeded or failed.
d = client.connect()

# We create a callback function to be called upon a successful connection
def on_connect_success(result):
    print "Connection was successful!"
    print "result:", result
    # Disconnect from the daemon once we successfully connect
    client.disconnect()
    # Stop the twisted main loop and exit
    reactor.stop()

# We add the callback to the Deferred object we got from connect()
d.addCallback(on_connect_success)

# We create another callback function to be called when an error is encountered
def on_connect_fail(result):
    print "Connection failed!"
    print "result:", result

# We add the callback (in this case it's an errback, for error)
d.addErrback(on_connect_fail)

# Run the twisted main loop to make everything go
reactor.run()

この問題をデバッグする方法がわかりません。私は Twisted に非常に慣れていませんが、私が理解していることから、それは巨大なライブラリです。

4

0 に答える 0