RPi-Distro / rpi-source

Raspberry Pi kernel source installer
MIT License
140 stars 39 forks source link

syntax error on line 261 when checking debian_changelog #13

Closed punkuotukas closed 1 year ago

punkuotukas commented 1 year ago

after updating imported libraries and python version, I ran in some syntax error that I cannot put the time to take a deeper look. when running rpi-source command, following output is thrown:

*** SoC: BCM2711

 *** Using: /usr/share/doc/raspberrypi-bootloader/changelog.Debian.gz
Traceback (most recent call last):
  File "/usr/local/bin/rpi-source", line 354, in <module>
    kernel = debian_method(debianlog)
  File "/usr/local/bin/rpi-source", line 261, in debian_method
    fw_rev = re.search(r'firmware as of ([0-9a-fA-F]+)', debian_changelog)
  File "/usr/lib/python3.9/re.py", line 201, in search
    return _compile(pattern, flags).search(string)
TypeError: cannot use a string pattern on a bytes-like object
pelwell commented 1 year ago

The first line of rpi-source says:

#!/usr/bin/env python2

and yet your error message comes from the RE module from Python 3.9.

What have you changed?

pelwell commented 1 year ago

You could try changing line 257 (https://github.com/RPi-Distro/rpi-source/blob/master/rpi-source#L257) to use mode 'rt' instead:

    with gzip.open(fn, 'rt') as f:

That continues to work using python2, so I'll change it if it fixes it for you.

lurch commented 1 year ago

You might want to check to see if #17 fixes this.

Hyrla commented 1 year ago

@lurch sadly it doesn't. Same issue here with the latest version