Opened 5 years ago

Last modified 2 years ago

#3313 new bug

GTKUI thinclient cannot start localhost daemon on Windows.

Reported by: mhertz Owned by:
Priority: minor Milestone: 2.0.6
Component: GTK UI Version: 2.0.3
Keywords: Cc:


Using Cas's manual install instructions for Deluge2 on windows 10, then when selecting 'Start daemon' from connection-manager, it fails with error message: "Check deluged package is installed and logs for further details".

Something i'm guessing is related, is that when starting deluged.exe manually, then it does work to connect to, but the daemon doesn't background itself no more, as it did in previous deluge 1.3.15, and no options to make it fork itself to background is available. The same with the webUI, so i'm guessing it is related with above issue, or otherwise there is two issues to report here.

The fix for pidfile creation(#3278), when applied, didn't fix either of these issues.

Thanks in advance.

Change History (6)

comment:1 by mhertz, 5 years ago

Sorry, forgot adding debug-logs previously. There where no errors shown when running debug-log of deluged.exe, but has issue as stated before of not going to background and staying in foreground, so if doubleclicking it, then it leaves the new terminal open, instead of just briefly "blinking" it.

Here follows snippet of erronymous part of debug-log of GTKUI in thinclient mode while selecting 'Start daemon' from connection-manager, which fails with error message in GUI as described in previous post:

15:16:26 [DEBUG   ][deluge.ui.client                  :286 ] sslproxy.connect()
15:16:26 [DEBUG   ][deluge.ui.client                  :212 ] Connecting to daemon at ""...
15:16:26 [DEBUG   ][deluge.ui.gtk3.connectionmanager  :241 ] Host Status:, 
15:16:27 [DEBUG   ][deluge.ui.client                  :219 ] Connection to daemon at "" failed: Connection was refused by other side: 10061: Der kunne ikke oprettes forbindelse, fordi destinationscomputeren aktivt nægtede det..
15:16:27 [DEBUG   ][deluge.ui.client                  :596 ] on_connect_fail: [Failure instance: Traceback (failure with no frames): <class 'twisted.internet.error.ConnectionRefusedError'>: Connection was refused by other side: 10061: Der kunne ikke oprettes forbindelse, fordi destinationscomputeren aktivt nægtede det..
15:16:27 [DEBUG   ][deluge.ui.client                  :302 ] sslproxy.disconnect()
15:16:27 [DEBUG   ][deluge.ui.hostlist                :203 ] Host status failed for 214f05ec5cdf46d794d3a17801d49e77: [Failure instance: Traceback (failure with no frames): <class 'twisted.internet.error.ConnectionRefusedError'>: Connection was refused by other side: 10061: Der kunne ikke oprettes forbindelse, fordi destinationscomputeren aktivt nægtede det..
15:16:27 [DEBUG   ][deluge.ui.gtk3.connectionmanager  :241 ] Host Status:, offline
15:16:30 [DEBUG   ][deluge.ui.gtk3.connectionmanager  :495 ] on_button_startdaemon_clicked
15:16:30 [ERROR   ][deluge.ui.client                  :688 ] Unable to start daemon!
15:16:30 [ERROR   ][deluge.ui.client                  :1343] a bytes-like object is required, not 'str'
Traceback (most recent call last):
  File "c:\program files\python36\lib\site-packages\deluge\ui\", line 674, in start_daemon
    subprocess.Popen(['deluged', '--port=%s' % port, b'--config=%s' % config])
  File "c:\program files\python36\lib\", line 729, in __init__
    restore_signals, start_new_session)
  File "c:\program files\python36\lib\", line 991, in _execute_child
    args = list2cmdline(args)
  File "c:\program files\python36\lib\", line 481, in list2cmdline
    needquote = (" " in arg) or ("\t" in arg) or not arg
TypeError: a bytes-like object is required, not 'str'

comment:2 by Torbjörn Lönnemark, 5 years ago

This can be fixed by applying the following change:

  • deluge/ui/

    diff --git a/deluge/ui/ b/deluge/ui/
    index 686f962b3..4db737c28 100644
    a b def start_daemon(self, port, config):  
    668668            bool: True is successfully started the daemon, False otherwise.
    670670        """
    671         # subprocess.popen does not work with unicode args (with non-ascii characters) on windows
    672         config = config.encode(sys.getfilesystemencoding())
    673671        try:
    674             subprocess.Popen(['deluged', '--port=%s' % port, b'--config=%s' % config])
     672            subprocess.Popen(['deluged', '--port=%s' % port, '--config=%s' % config])
    675673        except OSError as ex:
    676674            from errno import ENOENT

On Python 3 this works even when the config directory path contains non-ASCII characters, but on Python 2 it likely won't.

comment:3 by mhertz, 5 years ago

Awesome, thank you so much tobbez, I really appreciate this alot! :)

I now only have one issue left still, and that is that the deluged daemon still doesn't background itself, so when selecting 'Start daemon' from connection-manager, then there opens a terminal-window which keeps staying open, and the same if running deluged manually where it doesn't background itself, like it did in deluge 1.3.15. No errors though.

Do you have any ideas aabout that?

In either case, I really appreciated your help with this so many thanks again!

comment:4 by mhertz, 5 years ago

@tobbez, do the code you posted for .5 work for you locally?

I used my deluge2 from Cas's install-instructions and because of admin-rights needed, I copied deluged.exe into my win10 VM's user(fooba) Downloads folder and changed your code to match my system and then runned it and it did change the file I could see from the file-properties, and then I overwrote deluged.exe from Downloads and back to correct place again(I did backup it first), but the result is same as before and I can see python and not pythonw.exe runs deluged.exe still and doesn't background itself.

I apologize in advance if messing up your instructions, as that is very likely ;)

Edit: Sorry, forgot pasting in code used:

# replace PYTHONDIR with the root of your Python installation
with open(r'C:\Program Files\Python36\Lib\site-packages\pip\_vendor\distlib\w64.exe', 'rb') as f:
    launcher =
with open(r'C:\Users\fooba\Downloads\deluged.exe', 'rb') as f:
    d =
with open(r'C:\Users\fooba\Downloads\deluged.exe', 'wb') as f:
Version 1, edited 5 years ago by mhertz (previous) (next) (diff)

comment:5 by Calum, 2 years ago

Milestone: needs verified2.0.6

comment:6 by Calum, 2 years ago

Remember will need to verify can still handle non-ascii paths:

Note: See TracTickets for help on using tickets.