Python Scripting and Deluge

Suggest, post, or discuss plugins for Deluge
Post Reply
Maddux

Python Scripting and Deluge

Post by Maddux »

Hi Everybody, I'm wanting to experiment with managing some deluge stuff with Python. I'm a fairly new Python programmer and just looking for some things to tinker with. But before I even get off the ground I'm running into what I assume is a stupid problem. I'm getting this error:

Code: Select all

ImportError: No module named deluge.ui.client
This is attempting to run the sample script from this page: http://dev.deluge-torrent.org/wiki/Deve ... 3/UIClient
Here's the script:

Code: Select all

# Import the client module
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()
I've done a great deal of searching here on the forums and one post references the same error (http://forum.deluge-torrent.org/viewtop ... nt#p119905). One user points out that it means I can't see the deluge module, which seems right enough. But what do I do to install the module? Can't seem to figure it out. This is my first attempt at using an API like this one. I have all the Deluge dependencies installed (running Windows 8, btw), so what stupid thing am I missing?
Post Reply