#3385: TypeError: a bytes-like object is required, not 'str'
----------------------+----------------------------
  Reporter:  fdge00   |      Owner:
      Type:  bug      |     Status:  new
  Priority:  minor    |  Milestone:  needs verified
 Component:  Unknown  |    Version:  2.0.3
Resolution:           |   Keywords:
----------------------+----------------------------

Comment (by lyckeleb):

 SITUATION :

 OS  : Ubuntu 20.04.1  (xubuntu-desktop)
 PPA : "ppa:deluge-team/stable"

 To start deluge as a daemon, I created a systemd service file
 "/etc/systemd/system/deluged.service" containing

    ExecStart=/usr/bin/deluged  --port=56789  --do-not-daemonize
 --pidfile=/tmp/deluged.pid


 This gives the fatal failure "TypeError: a bytes-like object is required,
 not 'str'" on starting the service.

 -----------
 WORKAROUND :

 Remove the "--pidfile=/tmp/deluged.pid" from ExecStart.

 ---------------
 CAUSE:

 The file "/usr/lib/python3/dist-packages/deluge/argparserbase.py" contains
 {{{
     326           # Write pid file before chuid
     327           if options.pidfile:
     328               with open(options.pidfile, 'wb') as _file:
     329                   _file.write('%d\n' % os.getpid())
 }}}

 Line 328 enforces BINARY WRITES to the PID-file.
 But a string will be written in line 329.
 This causes a write-error (and ultimately the fatal failure).

 ---------------------
 SOLUTION :

 Change line 328 in
 {{{
     328               with open(options.pidfile, 'w') as _file:
 }}}
 The 'wb' is changed in 'w'. :)

--
Ticket URL: <https://dev.deluge-torrent.org/ticket/3385#comment:1>
Deluge <https://deluge-torrent.org/>
Deluge Project

-- 
You received this message because you are subscribed to the Google Groups 
"Deluge Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/deluge-dev/060.651129c0b4b2389cdf7c7a1283433397%40deluge-torrent.org.

Reply via email to