Skip to content

Errored when trying to export all to csv #10

Closed

Description

@EmanuelFaria

To Reproduce
Steps to reproduce the behavior:

  1. Go to I exported on my MacBook Pro running OS12.3 Monteray using the command in your readme:
    'things-cli --csv --recursive all > all.csv && open all.csv'
  2. See error _csv.Error: need to escape, but no escapechar set

Expected behavior
Clean export of cdv.

Additional context
Mannys-MacBook-Pro-2021:things-cli manny$ things-cli --csv --recursive all > all.csv && open all.csv
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/bin/things-cli", line 33, in
sys.exit(load_entry_point('things-cli==0.1.3', 'console_scripts', 'things-cli')())
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/things_cli-0.1.3-py3.10.egg/things_cli/cli.py", line 485, in main
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/things_cli-0.1.3-py3.10.egg/things_cli/cli.py", line 404, in main
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/things_cli-0.1.3-py3.10.egg/things_cli/cli.py", line 420, in main
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/things_cli-0.1.3-py3.10.egg/things_cli/cli.py", line 454, in parse_command
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/things_cli-0.1.3-py3.10.egg/things_cli/cli.py", line 74, in print_tasks
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/things_cli-0.1.3-py3.10.egg/things_cli/cli.py", line 147, in csv_dumps
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/things_cli-0.1.3-py3.10.egg/things_cli/cli.py", line 162, in csv_converter
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/things_cli-0.1.3-py3.10.egg/things_cli/cli.py", line 162, in csv_converter
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/things_cli-0.1.3-py3.10.egg/things_cli/cli.py", line 166, in csv_converter
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/csv.py", line 154, in writerow
return self.writer.writerow(self._dict_to_list(rowdict))
_csv.Error: need to escape, but no escapechar set

P.S. I would also like to filter out (omit) any logged or duplicate items. How do I do that?

Thanks!
Manny

Activity

  1. AlexanderWillner commented on Mar 20, 2022

    @AlexanderWillner
    Contributor

    Thanks for the feedback. That's interesting, as this never happened before with exporting literally thousands of to-dos. Couldn't reproduce it, but I've a suggested patch.

    Would you be able to checkout a modified version via git or change Line 144 in File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/things_cli-0.1.3-py3.10.egg/things_cli/cli.py from
    writer = csv.DictWriter(output, fieldnames=fieldnames, delimiter=";")
    to
    writer = csv.DictWriter(output, fieldnames=fieldnames, delimiter=";", escapechar='\\')
    ?

    Besides this, you can use all the filters (e.g, --filtertag) in the export. Run things-cli -h for details.

  2. EmanuelFaria commented on Mar 20, 2022

    @EmanuelFaria
    Author

    Thanks for the quick response!

    I edited line 144 as you said, and it worked!!

    Thank you!

  3. added a commit that references this issue on Mar 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions