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

Errored when trying to export all to csv #10

Closed
EmanuelFaria opened this issue Mar 20, 2022 · 2 comments
Closed

Errored when trying to export all to csv #10

EmanuelFaria opened this issue Mar 20, 2022 · 2 comments

Comments

@EmanuelFaria
Copy link

EmanuelFaria commented Mar 20, 2022

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

@AlexanderWillner
Copy link
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.

@EmanuelFaria
Copy link
Author

EmanuelFaria commented Mar 20, 2022

Thanks for the quick response!

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

Thank you!

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

No branches or pull requests

2 participants