Check-in [ef4ea389f1]
Overview
| Comment: | Fix `format_exc(e)` itself causing an exception, and add explanation in `pq` wrapper which was supposed to mask import errors. | 
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive | 
| Timelines: | family | ancestors | descendants | both | trunk | 
| Files: | files | file ages | folders | 
| SHA1: | ef4ea389f18b545d776b9ac8d6e36ae0 | 
| User & Date: | mario on 2020-12-12 14:17:07 | 
| Other Links: | manifest | tags | 
Context
| 2020-12-12 | ||
| 14:18 | try dual-dependencies on python2 & 3 check-in: 96049dfe04 user: mario tags: trunk | |
| 14:17 | Fix `format_exc(e)` itself causing an exception, and add explanation in `pq` wrapper which was supposed to mask import errors. check-in: ef4ea389f1 user: mario tags: trunk | |
| 14:16 | Cover ImportError with custom explanation check-in: 6f0655d209 user: mario tags: trunk | |
Changes
Modified config.py from [f8ba9ac1af] to [19c9d0f2fd].
| ︙ | ︙ | |||
| 377 378 379 380 381 382 383 | 
        if conf.windows:
            method = "[%s]" % method
        else:
            method = r"[{}[{}][0m".format(self.colors.get(method.split("_")[0], "47m"), method)
        # output
        print(
            method + " " + " " . join(
 | | | 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 | 
        if conf.windows:
            method = "[%s]" % method
        else:
            method = r"[{}[{}][0m".format(self.colors.get(method.split("_")[0], "47m"), method)
        # output
        print(
            method + " " + " " . join(
                format_exc() if isinstance(a, Exception) else str(a) for a in args
            ),
            file=sys.stderr
        )
    # Colors
    colors = {
        "ERR":  "31m",          # red    ERROR
 | 
| ︙ | ︙ | 
Modified pq.py from [42781be023] to [63fd55ca67].
| ︙ | ︙ | |||
| 22 23 24 25 26 27 28 | 
except Exception as e:
    # disable use
    pq = None
    config.conf.pyquery = False
    # error hint
 | | | > | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | 
except Exception as e:
    # disable use
    pq = None
    config.conf.pyquery = False
    # error hint
    config.log.ERR("LXML/PyQuery is missing", e)
    config.log.INFO("Please install the packages python-lxml and python-pyquery from your distributions software manager.")
    config.log.INFO("Or via `pip install pyquery`\nOr `pip3 install pyquery`")
    # let's invoke packagekit?
    """
    try:
         import packagekit.client
         pkc = packagekit.client.PackageKitClient()
 | 
| ︙ | ︙ |