Error starting Deluge with Applescript

Support for Deluge on Apple Mac OS
New User
New User
Posts: 4
Joined: Fri Nov 19, 2010 9:16 am

Error starting Deluge with Applescript

Postby halfthelaw » Thu Dec 02, 2010 7:09 am

Thanks so much, the above steps worked like a charm!

Now,I'm trying to launch deluge-gtk with a simple AppleScript:

Code: Select all

do shell script "/opt/local/bin/deluge-gtk-2.6"

However, when I try to do this I get the most hideous error:

Code: Select all

error "Traceback (most recent call last):
  File \"/opt/local/bin/deluge-gtk-2.6\", line 9, in <module>
    load_entry_point('deluge==1.3.1', 'gui_scripts', 'deluge-gtk')()
  File \"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/deluge/ui/gtkui/\", line 107, in start
  File \"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/deluge/ui/gtkui/\", line 104, in start
  File \"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/deluge/ui/gtkui/\", line 193, in __init__
    self.config = deluge.configmanager.ConfigManager(\"gtkui.conf\", DEFAULT_PREFS)
  File \"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/deluge/\", line 122, in ConfigManager
    return _configmanager.get_config(config, defaults)
  File \"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/deluge/\", line 114, in get_config
    self.config_files[config_file] = Config(config_file, defaults, self.config_directory)
  File \"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/deluge/\", line 150, in __init__
    self.set_item(key, value)
  File \"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/deluge/\", line 192, in set_item
    value = deluge.common.utf8_encoded(value)
  File \"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/deluge/\", line 594, in utf8_encoded
    s = decode_string(s, locale.getpreferredencoding())
  File \"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/deluge/\", line 578, in decode_string
    s = s.decode(encoding).encode(\"utf8\", \"ignore\")
LookupError: unknown encoding: " number 1

Any ideas on how to fix?

Top Bloke
Top Bloke
Posts: 3570
Joined: Mon Dec 07, 2009 6:04 am
Location: Scotland

Re: Error starting Deluge with Applescript

Postby Cas » Thu Dec 02, 2010 2:49 pm

I have split this from the original thread, as it was not directly related to the topic.

You have not said whether deluge runs fine from the command line.

Posts: 66
Joined: Fri Dec 03, 2010 1:55 am

Re: Error starting Deluge with Applescript

Postby CSB » Fri Dec 03, 2010 7:15 pm

The script works for me if I execute it using osascript, however not with the apple script editor, or any other method.
[code]tell application "Terminal" to do script "/bin/bash -c 'deluge-gtk-2.6 &> /dev/null &' ; exit 0 ; exit 0"/code]

Does the job on my end. Who the hell knows why you need such a kludge to do it.
Actually, each hacky bit explained:
sh is the default shell applescript uses, so you need to call bash.
getting rid of all of the barf that deluge might spit up will probably be necessary, so redirect it to /dev/null
the first exit 0 tells applescript everything is ok
the second exit 0 gets rid of the terminal window all this happened in

oh yeah, and you have to tell terminal to do it otherwise deluge gets killed for godknowswhy.


Re: Error starting Deluge with Applescript

Postby jaychow » Thu Dec 23, 2010 10:19 pm

I successfully installed Deluge 1.3.1 and Python 2.6.6 on Mac OS X 10.6.5 in their default locations. But I got tired of typing in Terminal "deluged-2.6 &" and "deluge-2.6 &". So, after some search on this forum, I wrote an AppleScript:

do shell script "/opt/local/bin/deluged-2.6 & /opt/local/bin/deluge-2.6"

and saved as an application. I don't like to asymmetry of the Deluge logo, so I updated it in icongrapher and applied it to the app.

Please let me know how it works for you.
App created from AppleScript, inplace of Terminal command line entries.
(34.99 KiB) Downloaded 198 times

Return to “Mac OS”

Who is online

Users browsing this forum: No registered users and 1 guest