NayamAmarshe / please

🙏 Please CLI - Minimalistic New Tab Page CLI Tool with a greeting, date and time, inspirational quotes and your personal tasks and to-do list
MIT License
582 stars 26 forks source link

JSON error... #24

Closed BadWolf47 closed 2 years ago

BadWolf47 commented 2 years ago

╭───────────────────── Traceback (most recent call last) ──────────────────────╮ │ /home/depressedpineapple/.local/lib/python3.8/site-packages/please/please.py │ │ :330 in main │ │ │ │ 327 │ try: │ │ 328 │ │ with open(os.path.join(configpath, "config.json")) as config │ │ 329 │ │ │ global config │ │ ❱ 330 │ │ │ config = json.load(config_file) │ │ 331 │ except FileNotFoundError: │ │ 332 │ │ open(os.path.join(config_path, "config.json"), "w") │ │ 333 │ │ typer.run(setup) │ │ │ │ ╭───────────────────────────────── locals ─────────────────────────────────╮ │ │ │ config_file = <_io.TextIOWrapper │ │ │ │ name='/home/depressedpineapple/.config/please/config.json' │ │ │ │ mode='r' encoding='UTF-8'> │ │ │ ╰──────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /usr/lib/python3.8/json/init.py:293 in load │ │ │ │ 290 │ To use a custom JSONDecoder subclass, specify it with the cl │ │ 291 │ kwarg; otherwiseJSONDecoderis used. │ │ 292 │ """ │ │ ❱ 293 │ return loads(fp.read(), │ │ 294 │ │ cls=cls, object_hook=object_hook, │ │ 295 │ │ parse_float=parse_float, parse_int=parse_int, │ │ 296 │ │ parse_constant=parse_constant, object_pairs_hook=object_pairs_ │ │ │ │ ╭───────────────────────────────── locals ─────────────────────────────────╮ │ │ │ cls = None │ │ │ │ fp = <_io.TextIOWrapper │ │ │ │ name='/home/depressedpineapple/.config/please/confi… │ │ │ │ mode='r' encoding='UTF-8'> │ │ │ │ kw = {} │ │ │ │ object_hook = None │ │ │ │ object_pairs_hook = None │ │ │ │ parse_constant = None │ │ │ │ parse_float = None │ │ │ │ parse_int = None │ │ │ ╰──────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /usr/lib/python3.8/json/__init__.py:357 in loads │ │ │ │ 354 │ if (cls is None and object_hook is None and │ │ 355 │ │ │ parse_int is None and parse_float is None and │ │ 356 │ │ │ parse_constant is None and object_pairs_hook is None and n │ │ ❱ 357 │ │ return _default_decoder.decode(s) │ │ 358 │ if cls is None: │ │ 359 │ │ cls = JSONDecoder │ │ 360 │ if object_hook is not None: │ │ │ │ ╭───────── locals ─────────╮ │ │ │ cls = None │ │ │ │ kw = {} │ │ │ │ object_hook = None │ │ │ │ object_pairs_hook = None │ │ │ │ parse_constant = None │ │ │ │ parse_float = None │ │ │ │ parse_int = None │ │ │ │ s = '' │ │ │ ╰──────────────────────────╯ │ │ │ │ /usr/lib/python3.8/json/decoder.py:337 in decode │ │ │ │ 334 │ │ containing a JSON document). │ │ 335 │ │ │ │ 336 │ │ """ │ │ ❱ 337 │ │ obj, end = self.raw_decode(s, idx=_w(s, 0).end()) │ │ 338 │ │ end = _w(s, end).end() │ │ 339 │ │ if end != len(s): │ │ 340 │ │ │ raise JSONDecodeError("Extra data", s, end) │ │ │ │ ╭─────────────────────────────── locals ────────────────────────────────╮ │ │ │ _w = <built-in method match of re.Pattern object at 0x7fcd86338cf0> │ │ │ │ s = '' │ │ │ │ self = <json.decoder.JSONDecoder object at 0x7fcd862a6a30> │ │ │ ╰───────────────────────────────────────────────────────────────────────╯ │ │ │ │ /usr/lib/python3.8/json/decoder.py:355 in raw_decode │ │ │ │ 352 │ │ try: │ │ 353 │ │ │ obj, end = self.scan_once(s, idx) │ │ 354 │ │ except StopIteration as err: │ │ ❱ 355 │ │ │ raise JSONDecodeError("Expecting value", s, err.value) fro │ │ 356 │ │ return obj, end │ │ 357 │ │ │ │ ╭────────────────────────── locals ──────────────────────────╮ │ │ │ idx = 0 │ │ │ │ s = '' │ │ │ │ self = <json.decoder.JSONDecoder object at 0x7fcd862a6a30> │ │ │ ╰────────────────────────────────────────────────────────────╯ │ ╰──────────────────────────────────────────────────────────────────────────────╯ JSONDecodeError: Expecting value: line 1 column 1 (char 0) Failed while loading configuration ╭───────────────────── Traceback (most recent call last) ──────────────────────╮ │ /home/depressedpineapple/.local/lib/python3.8/site-packages/please/please.py │ │ :330 in main │ │ │ │ 327 │ try: │ │ 328 │ │ with open(os.path.join(config_path, "config.json")) as config_ │ │ 329 │ │ │ global config │ │ ❱ 330 │ │ │ config = json.load(config_file) │ │ 331 │ except FileNotFoundError: │ │ 332 │ │ open(os.path.join(config_path, "config.json"), "w") │ │ 333 │ │ typer.run(setup) │ │ │ │ ╭───────────────────────────────── locals ─────────────────────────────────╮ │ │ │ config_file = <_io.TextIOWrapper │ │ │ │ name='/home/depressedpineapple/.config/please/config.json' │ │ │ │ mode='r' encoding='UTF-8'> │ │ │ ╰──────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /usr/lib/python3.8/json/__init__.py:293 in load │ │ │ │ 290 │ To use a customJSONDecodersubclass, specify it with thecl │ │ 291 │ kwarg; otherwise JSONDecoder is used. │ │ 292 │ """ │ │ ❱ 293 │ return loads(fp.read(), │ │ 294 │ │ cls=cls, object_hook=object_hook, │ │ 295 │ │ parse_float=parse_float, parse_int=parse_int, │ │ 296 │ │ parse_constant=parse_constant, object_pairs_hook=objectpairs │ │ │ │ ╭───────────────────────────────── locals ─────────────────────────────────╮ │ │ │ cls = None │ │ │ │ fp = <_io.TextIOWrapper │ │ │ │ name='/home/depressedpineapple/.config/please/confi… │ │ │ │ mode='r' encoding='UTF-8'> │ │ │ │ kw = {} │ │ │ │ object_hook = None │ │ │ │ object_pairs_hook = None │ │ │ │ parse_constant = None │ │ │ │ parse_float = None │ │ │ │ parse_int = None │ │ │ ╰──────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /usr/lib/python3.8/json/init.py:357 in loads │ │ │ │ 354 │ if (cls is None and object_hook is None and │ │ 355 │ │ │ parse_int is None and parse_float is None and │ │ 356 │ │ │ parse_constant is None and object_pairs_hook is None and n │ │ ❱ 357 │ │ return _default_decoder.decode(s) │ │ 358 │ if cls is None: │ │ 359 │ │ cls = JSONDecoder │ │ 360 │ if object_hook is not None: │ │ │ │ ╭───────── locals ─────────╮ │ │ │ cls = None │ │ │ │ kw = {} │ │ │ │ object_hook = None │ │ │ │ object_pairs_hook = None │ │ │ │ parse_constant = None │ │ │ │ parse_float = None │ │ │ │ parse_int = None │ │ │ │ s = '' │ │ │ ╰──────────────────────────╯ │ │ │ │ /usr/lib/python3.8/json/decoder.py:337 in decode │ │ │ │ 334 │ │ containing a JSON document). │ │ 335 │ │ │ │ 336 │ │ """ │ │ ❱ 337 │ │ obj, end = self.raw_decode(s, idx=_w(s, 0).end()) │ │ 338 │ │ end = _w(s, end).end() │ │ 339 │ │ if end != len(s): │ │ 340 │ │ │ raise JSONDecodeError("Extra data", s, end) │ │ │ │ ╭─────────────────────────────── locals ────────────────────────────────╮ │ │ │ _w = <built-in method match of re.Pattern object at 0x7fcd86338cf0> │ │ │ │ s = '' │ │ │ │ self = <json.decoder.JSONDecoder object at 0x7fcd862a6a30> │ │ │ ╰───────────────────────────────────────────────────────────────────────╯ │ │ │ │ /usr/lib/python3.8/json/decoder.py:355 in raw_decode │ │ │ │ 352 │ │ try: │ │ 353 │ │ │ obj, end = self.scan_once(s, idx) │ │ 354 │ │ except StopIteration as err: │ │ ❱ 355 │ │ │ raise JSONDecodeError("Expecting value", s, err.value) fro │ │ 356 │ │ return obj, end │ │ 357 │ │ │ │ ╭────────────────────────── locals ──────────────────────────╮ │ │ │ idx = 0 │ │ │ │ s = '' │ │ │ │ self = <json.decoder.JSONDecoder object at 0x7fcd862a6a30> │ │ │ ╰────────────────────────────────────────────────────────────╯ │ ╰──────────────────────────────────────────────────────────────────────────────╯ JSONDecodeError: Expecting value: line 1 column 1 (char 0) Failed while loading configuration

NayamAmarshe commented 2 years ago

How did this occur? Were you trying to modify the config file?

Stanley9990 commented 2 years ago

How did this occur? Were you trying to modify the config file?

I have the same error. After using pip to install the program, the config file is blank. In the meantime can you paste an example config file so I can fix the issue?

kshitijaucharmal commented 2 years ago

Yeah please provide a sample config its literally blank

kshitijaucharmal commented 2 years ago

Found it! I'm actually an idiot, this image https://github.com/NayamAmarshe/please/blob/master/illustration1.jpg showed the basics clearly. You can probably close this issue, but please include a sample config at install ;) (Note: the location for the config is ~/.config/please/config.json file)

Stanley9990 commented 2 years ago

Found it! I'm actually an idiot, this image https://github.com/NayamAmarshe/please/blob/master/illustration1.jpg showed the basics clearly. You can probably close this issue, but please include a sample config at install ;) (Note: the location for the config is ~/.config/please/config.json file)

Yeah I saw that, but it'd be nicer to be able to copy the text for the config, or have an actual json file to add and then edit. The config file not being generated by default is still an issue though, as it's not specified in any of the installation or Documentation.

NayamAmarshe commented 2 years ago

Found it! I'm actually an idiot, this image https://github.com/NayamAmarshe/please/blob/master/illustration1.jpg showed the basics clearly. You can probably close this issue, but please include a sample config at install ;) (Note: the location for the config is ~/.config/please/config.json file)

Yeah I saw that, but it'd be nicer to be able to copy the text for the config, or have an actual json file to add and then edit. The config file not being generated by default is still an issue though, as it's not specified in any of the installation or Documentation.

I haven't encountered this bug, last time I released it, it was working perfectly fine. I'll check what's the issue.

Stanley9990 commented 2 years ago

Found it! I'm actually an idiot, this image https://github.com/NayamAmarshe/please/blob/master/illustration1.jpg showed the basics clearly. You can probably close this issue, but please include a sample config at install ;) (Note: the location for the config is ~/.config/please/config.json file)

Yeah I saw that, but it'd be nicer to be able to copy the text for the config, or have an actual json file to add and then edit. The config file not being generated by default is still an issue though, as it's not specified in any of the installation or Documentation.

I haven't encountered this bug, last time I released it, it was working perfectly fine. I'll check what's the issue.

I'm using Ubuntu 22.04, python version 3.10.4, and installed using pip3 install please-cli --upgrade. If you require any more information please let me know.

NayamAmarshe commented 2 years ago

Can you try uninstalling and removing config file and only doing:

pip3 install please-cli

Stanley9990 commented 2 years ago

Can you try uninstalling and removing config file and only doing:

pip3 install please-cli

The same issue occurs, the config file generated is blank.

kshitijaucharmal commented 2 years ago

The program is fine after I copied the config from the Image mentioned, but before that I tried all the methods in the readme, the pip one and the wheel one, and also I downloaded the repo to try directly, but still had no luck. You need to look into this issue I guess I'm on manjaro btw with python 3.10

NayamAmarshe commented 2 years ago

The program is fine after I copied the config from the Image mentioned, but before that I tried all the methods in the readme, the pip one and the wheel one, and also I downloaded the repo to try directly, but still had no luck. You need to look into this issue I guess I'm on manjaro btw with python 3.10

I'll take a look. Something's definitely going wrong on some machines.

NayamAmarshe commented 2 years ago

Fixed in v0.3, please upgrade. This bug happens due to an empty or invalid JSON in config. You can use https://jsonlint.com/ to check whether your config is good or not. Make sure to not have any , symbols at the end of the last line.