简体   繁体   中英

Python errors show up with Rust Cargo

When I try run a library example with Cargo for some reason a Python error comes up. I have no idea why or how this is happening, does anyone think they might know how to fix this?

cargo run --example lib_example
module 'json' has no attribute 'JSONDecodeError'
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py", line 117, in get_snaps
    snaps = json.loads(output)
AttributeError: module 'json' has no attribute 'loads'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/CommandNotFound/util.py", line 23, in crash_guard
    callback()
  File "/usr/lib/command-not-found", line 95, in main
    if not cnf.advise(args[0], options.ignore_installed) and not options.no_failure_msg:
  File "/usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py", line 364, in advise
    snaps, mispell_snaps = self.get_snaps(command)
  File "/usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py", line 118, in get_snaps
    except json.JSONDecodeError as e:
AttributeError: module 'json' has no attribute 'JSONDecodeError'

I don't know why but running which for cargo then restarting somehow fixed it.

which cargo
sudo reboot

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM