You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
jrnl: v2.8.4
Python: 3.9.7 (tags/v3.9.7:1016ef3, Aug 30 2021, 20:19:38) [MSC v.1929 64 bit (AMD64)]
OS: Windows 10
Install method: pipx
Current Behavior / Repro Steps / Expected behavior
The list of formats outputted by jrnl is the same whether we're talking about importing or exporting. To see this in action, enter in a nonsensical import format like so:
All those formats that jrnl offers are export formats and none are import formats (the only import format is jrnl), so that message shouldn't appear.
If you try any of those formats, jrnl crashes with a traceback like so:
>jrnl --import --format json
Traceback (most recent call last):
File "C:\Users\micah\.pyenv\pyenv-win\versions\3.9.7\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\micah\.pyenv\pyenv-win\versions\3.9.7\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\micah\.local\bin\jrnl.exe\__main__.py", line 7, in <module>
File "C:\Users\micah\.local\pipx\venvs\jrnl\lib\site-packages\jrnl\cli.py", line 34, in cli
return run(args)
File "C:\Users\micah\.local\pipx\venvs\jrnl\lib\site-packages\jrnl\jrnl.py", line 53, in run
return args.postconfig_cmd(
File "C:\Users\micah\.local\pipx\venvs\jrnl\lib\site-packages\jrnl\commands.py", line 57, in postconfig_import
get_importer(format).import_(journal, args.filename)
AttributeError: 'NoneType' object has no attribute 'import_'
It should show a user-friendly error message instead, probably explaining that this is only an export format, not an import format.
Instead of --import paying attention to --format, leave --format
just for the export-format and give --import itself an optional
arguent that is the import format. This of course defaults to 'jrnl'.
This allows argparse to do the choice-checking.
Bug Report
Environment
jrnl --diagnostic
output:Current Behavior / Repro Steps / Expected behavior
The list of formats outputted by jrnl is the same whether we're talking about importing or exporting. To see this in action, enter in a nonsensical import format like so:
All those formats that jrnl offers are export formats and none are import formats (the only import format is jrnl), so that message shouldn't appear.
If you try any of those formats, jrnl crashes with a traceback like so:
It should show a user-friendly error message instead, probably explaining that this is only an export format, not an import format.
Other Information
Found this out after spotting discussion #1476.
The text was updated successfully, but these errors were encountered: