PrivacyScore / privacyscanner

Privacyscanner is the new scanning backend component of a future PrivacyScore version
MIT License
20 stars 11 forks source link

Issues with python 3.5 #19

Closed maltekrupa closed 4 years ago

maltekrupa commented 5 years ago

Hi,

I hit two issues with python 3.5 both on 0.7.2 and a fresh clone from this repo:

root@b179dfd1fb3e:/app# python3 --version
Python 3.5.3
root@b179dfd1fb3e:/app# cat /etc/issue
Debian GNU/Linux 9 \n \l
root@b179dfd1fb3e:/app# python3 privacyscanner/scanner.py scan http://nafn.de
Traceback (most recent call last):
  File "/venv/bin/privacyscanner", line 11, in <module>
    sys.exit(main())
  File "/venv/lib/python3.5/site-packages/privacyscanner/scanner.py", line 289, in main
    args.func(args)
  File "/venv/lib/python3.5/site-packages/privacyscanner/scanner.py", line 108, in scan_site
    results_dir = Path(results_dir).resolve()
  File "/usr/lib/python3.5/pathlib.py", line 1109, in resolve
    s = self._flavour.resolve(self)
  File "/usr/lib/python3.5/pathlib.py", line 330, in resolve
    return _resolve(base, str(path)) or sep
  File "/usr/lib/python3.5/pathlib.py", line 315, in _resolve
    target = accessor.readlink(newpath)
  File "/usr/lib/python3.5/pathlib.py", line 422, in readlink
    return os.readlink(path)
FileNotFoundError: [Errno 2] No such file or directory: '//nafn.de_c68c90e52c'

After creating the directory manually:

root@b179dfd1fb3e:/app# python3 privacyscanner/scanner.py scan http://nafn.de
chromedevtools> 2019-05-02 06:20:37,451: [INFO] Starting chromedevtools (scanner.py:180)
chromedevtools> 2019-05-02 06:20:42,866: [ERROR] Scan module `chromedevtools` failed. (scanner.py:198)
Traceback (most recent call last):
  File "privacyscanner/scanner.py", line 185, in scan_site
    mod.scan_site(result, scan_meta)
  File "/app/privacyscanner/scanmodules/chromedevtools/__init__.py", line 47, in scan_site
    content = chrome_scan.scan(result, self.logger, self.options, meta, debugging_port)
  File "/app/privacyscanner/scanmodules/chromedevtools/chromescan.py", line 263, in scan
    content = scanner.scan(browser, result, logger, options)
  File "/app/privacyscanner/scanmodules/chromedevtools/chromescan.py", line 411, in scan
    self._extract_information()
  File "/app/privacyscanner/scanmodules/chromedevtools/chromescan.py", line 560, in _extract_information
    extractor.extract_information()
  File "/app/privacyscanner/scanmodules/chromedevtools/extractors/trackerdetect.py", line 19, in extract_information
    self._load_rules()
  File "/app/privacyscanner/scanmodules/chromedevtools/extractors/trackerdetect.py", line 79, in _load_rules
    skip_parsing_errors=True)
  File "/usr/local/lib/python3.5/dist-packages/adblockeval/rules.py", line 50, in __init__
    self.rules += self._parse_rules(f.readlines(), str(rule_file))
  File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd8 in position 2598: ordinal not in range(128)

Both issues disappeared when I started using python 3.6/3.7 on ubuntu 1804 and debian stretch based docker containers.

Even though I moved to a more recent version of python I wanted to inform you about these issues.

Gruesse Malte

hprid commented 4 years ago

Python 3.5 is too old and makes to many complications in the development. So I decided to drop Python 3.5 support in version 0.8.