Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading to 4.7.2 breaks invoke livereload #2992

Closed
2 tasks done
dflock opened this issue Mar 19, 2022 · 6 comments · Fixed by #2994
Closed
2 tasks done

Upgrading to 4.7.2 breaks invoke livereload #2992

dflock opened this issue Mar 19, 2022 · 6 comments · Fixed by #2994
Labels

Comments

@dflock
Copy link

dflock commented Mar 19, 2022

  • I have read the Filing Issues and subsequent “How to Get Help” sections of the documentation.
  • I have searched the issues (including closed ones) and believe that this is not a duplicate.

Issue

Currently using 4.7.1, everything works fine. Running invoke livereload works.
If I upgrade to Pelican 4.7.2, then invoke livereload breaks:

$ invoke livereload

Traceback (most recent call last):
  File "/home/duncan/venv/duncanlock.net-venv/lib/python3.8/site-packages/pelican/__init__.py", line 275, in __call__
    overrides[k] = json.loads(v)
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/duncan/venv/duncanlock.net-venv/bin/invoke", line 8, in <module>
    sys.exit(program.run())
  File "/home/duncan/venv/duncanlock.net-venv/lib/python3.8/site-packages/invoke/program.py", line 384, in run
    self.execute()
  File "/home/duncan/venv/duncanlock.net-venv/lib/python3.8/site-packages/invoke/program.py", line 566, in execute
    executor.execute(*self.tasks)
  File "/home/duncan/venv/duncanlock.net-venv/lib/python3.8/site-packages/invoke/executor.py", line 129, in execute
    result = call.task(*args, **call.kwargs)
  File "/home/duncan/venv/duncanlock.net-venv/lib/python3.8/site-packages/invoke/tasks.py", line 127, in __call__
    result = self.body(*args, **kwargs)
  File "/home/duncan/Projects/duncanlock.net/tasks.py", line 95, in livereload
    cached_build()
  File "/home/duncan/Projects/duncanlock.net/tasks.py", line 93, in cached_build
    pelican_run(cmd.format(**CONFIG))
  File "/home/duncan/Projects/duncanlock.net/tasks.py", line 138, in pelican_run
    pelican_main(shlex.split(cmd))
  File "/home/duncan/venv/duncanlock.net-venv/lib/python3.8/site-packages/pelican/__init__.py", line 526, in main
    args = parse_arguments(argv)
  File "/home/duncan/venv/duncanlock.net-venv/lib/python3.8/site-packages/pelican/__init__.py", line 391, in parse_arguments
    args = parser.parse_args(argv)
  File "/usr/lib/python3.8/argparse.py", line 1780, in parse_args
    args, argv = self.parse_known_args(args, namespace)
  File "/usr/lib/python3.8/argparse.py", line 1812, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
  File "/usr/lib/python3.8/argparse.py", line 2018, in _parse_known_args
    start_index = consume_optional(start_index)
  File "/usr/lib/python3.8/argparse.py", line 1958, in consume_optional
    take_action(action, args, option_string)
  File "/usr/lib/python3.8/argparse.py", line 1886, in take_action
    action(self, namespace, argument_values, option_string)
  File "/home/duncan/venv/duncanlock.net-venv/lib/python3.8/site-packages/pelican/__init__.py", line 277, in __call__
    raise ValueError(
ValueError: Invalid JSON value: True. Values specified via -e / --extra-settings flags must be in JSON notation. Use -e KEY='"string"' to specify a string value; -e KEY=null to specify None; -e KEY=false (or true) to specify False (or True).

My tasks.py file can be see here, but it's pretty much just the default one - I haven't changed any of the global stuff at the top. My pelicanconf.py is here, and hasn't changed in a while - and works fine with 4.7.1

This looks very much like it's caused by this: #2938 - although I'm not using --extra-settings anywhere.

@dflock dflock added the bug label Mar 19, 2022
@justinmayer
Copy link
Member

justinmayer commented Mar 19, 2022 via email

@dflock
Copy link
Author

dflock commented Mar 19, 2022

I haven't dug into the code, but it looks like it's trying to treat the imported pelicanconf.py as JSON?

@avaris
Copy link
Member

avaris commented Mar 23, 2022

Issue is here. Trues here should be changed to JSON-like counterparts (true).

@justinmayer
Copy link
Member

@avaris: Many thanks for fixing this!

@dflock
Copy link
Author

dflock commented Apr 5, 2022

I've tested this by updating my local tasks.py file, and it works, I can now upgrade to 4.7.2, thanks!

I think that anyone else who's using a version of the default task.py file, will probably also have to edit their local version of the file, in order to fix this when they upgrade?

@avaris
Copy link
Member

avaris commented Apr 7, 2022

Yes, unfortunately people need to manually edit their existing tasks.py files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants