[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Started porting UDD to Python3 (Was: [UDD] Is there some effort to port UDD to Python3?)



On Wed, May 13, 2020 at 07:40:56PM +0200, Andreas Tille wrote:
> > 
> > Use the Vagrant development environment?
> 
> I admit I've never worked with this.  You said its pretty simple and I
> would guess a python3 branch where everybody commits the code he feels
> responsible for and test it would be sufficient.  But I'm fine to adapt
> (if you point me to some doc).

I've just followed my proposal to create a python3 branch, fired up 2to3
and fixed some issues manually.  My gatherers blends-prospective, ftpnew
and screenshots should work.  I'm now stumbling upon:

udd(python3) $ ./only-run.sh ddtp
Traceback (most recent call last):
  File "/srv/udd.debian.org/udd//udd.py", line 88, in <module>
    exec("gatherer.%s()" % command)
  File "<string>", line 1, in <module>
  File "/srv/udd.debian.org/udd/udd/ddtp_gatherer.py", line 125, in run
    h.update(f.read())
  File "/usr/lib/python3.8/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc5 in position 11: invalid continuation byte


I tried to fix this using this patch:


$ git diff
diff --git a/udd/ddtp_gatherer.py b/udd/ddtp_gatherer.py
index 46e588d..7cc625c 100644
--- a/udd/ddtp_gatherer.py
+++ b/udd/ddtp_gatherer.py
@@ -117,7 +117,7 @@ class ddtp_gatherer(gatherer):
           trfile = trfilepath + file
           # check whether hash recorded in index file fits real file
           try:
-            f = open(trfile)
+            f = open(trfile, encoding='utf-8')
           except IOError as err:
             self.log.error("%s: %s.", str(err), trfile)
             continue


but it does not help.  Any hint would be welcome.

Kind regards

       Andreas. 

-- 
http://fam-tille.de


Reply to: