Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.bugs.rc > #266458

Bug#937262: Help needed (Was: pdb2pqr: Python2 removal in sid/bullseye)

From Scott Talbert <swt@techie.net>
Newsgroups linux.debian.bugs.rc
Subject Bug#937262: Help needed (Was: pdb2pqr: Python2 removal in sid/bullseye)
Date 2019-12-12 17:40 +0100
Message-ID <zczFn-19B-5@gated-at.bofh.it> (permalink)
References <zczcl-ZB-1@gated-at.bofh.it> <zczm1-12V-7@gated-at.bofh.it> <zczcl-ZB-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, 12 Dec 2019, Andreas Tille wrote:

> Control: tags -1 help
>
> Hi,
>
> it seems pdb2pqr is orphaned upstream.  However, it seems to be worth
> keeping inside Debian thus I tried my luck to port it to Python3 in
> Git[1].  Unfortunately the build runs into
>
>      scons: Building targets ...
>      CopySubAction("pdb2pqr.py", "pdb2pqr.py.in")
>      scons: *** [pdb2pqr.py] TypeError : a bytes-like object is required, not 'str'
>      Traceback (most recent call last):
>        File "/usr/lib/scons/SCons/Action.py", line 1209, in execute
>          result = self.execfunction(target=target, source=rsources, env=env)
>        File "/usr/lib/scons/SCons/Action.py", line 1371, in __call__
>          return self.parent.actfunc(*args, **kw)
>        File "./site_scons/site_init.py", line 123, in CopySubAction
>          contents = contents.replace(k, v)
>      TypeError: a bytes-like object is required, not 'str'
>      scons: building terminated because of errors.
>
> I wonder whether it might just be a scons issue.  Please note that I'm
> using scons 3.1.1-4 from experimental that is supposed to run with
> Python3.
>
> Any hint would be welcome.
>
> Kind regards
>
>       Andreas.
>
>
> [1] https://salsa.debian.org/med-team/pdb2pqr

I don't see any Python3 changes in that repository.  Did you push your 
changes?

Anyway, the problem is likely in CopySubAction in site_scons/site_init.py.

On line 111, the file 'sourcefile' is opened as binary.  Then, when then 
next line, 'contents = r.read()' is executed, contents ends up as a bytes 
object.  Thus on line 123, when 'contents = contents.replace(k, v)' is 
executed, contents is a bytes object, whereas k and v are strings.  You 
can't mix strings and bytes objects like that in Python 3.

You could perhaps try opening the file as a text file instead (remove the 
'b') from the open function call.

Scott

Back to linux.debian.bugs.rc | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Bug#937262: Help needed (Was: pdb2pqr: Python2 removal in sid/bullseye) Scott Talbert <swt@techie.net> - 2019-12-12 17:40 +0100
  Bug#937262: Help with scons needed (Was: Help needed (Was: pdb2pqr: Python2 removal in sid/bullseye)) Andreas Tille <andreas@fam-tille.de> - 2019-12-12 21:20 +0100
    Bug#937262: Help with scons needed (Was: Help needed (Was: pdb2pqr: Python2 removal in sid/bullseye)) Andreas Tille <andreas@fam-tille.de> - 2019-12-12 22:20 +0100
      Bug#937262: Help with scons needed (Was: Help needed (Was: pdb2pqr: Python2 removal in sid/bullseye)) Scott Talbert <swt@techie.net> - 2019-12-12 22:40 +0100
        Bug#937262: Help with scons needed (Was: Help needed (Was: pdb2pqr: Python2 removal in sid/bullseye)) Andrey Rahmatullin <wrar@debian.org> - 2019-12-13 14:00 +0100
          Bug#937262: Help with scons needed (Was: Help needed (Was: pdb2pqr: Python2 removal in sid/bullseye)) Andreas Tille <tille@debian.org> - 2019-12-13 15:30 +0100
            Bug#937262: Help needed (Was: pdb2pqr: Python2 removal in sid/bullseye) Andreas Tille <tille@debian.org> - 2019-12-13 22:20 +0100

csiph-web