Open andriy-appuchino opened 4 years ago
Do you have lxml
installed? If not, run this in your terminal:
pip install lxml
Did that solve your issue?
Probably not. But today I successfully installed it this way:
brew install python
pip3 install lxml
But the result is the same.
Ah, if you installed lxml for python3, then you might want to try running the script like so:
python3 wunderlist_to_evernote.py wunderlist-xxx.json
Did that work?
Yeah almost..
Traceback (most recent call last):
File "wunderlist_to_evernote.py", line 8, in <module>
import pandas as pd
ModuleNotFoundError: No module named 'pandas'
But I got how to make it work :)
After installing pandas, it started, and I got such output:
wunderlist_to_evernote.py: Using Tasks.json as input
Traceback (most recent call last):
File "wunderlist_to_evernote.py", line 149, in <module>
wunderlist_to_evernote(input_file, output_file)
File "wunderlist_to_evernote.py", line 14, in wunderlist_to_evernote
wunderlist = json.load(wunderlist_raw)
File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/__init__.py", line 296, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/__init__.py", line 338, in loads
s, 0)
json.decoder.JSONDecodeError: Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 column 1 (char 0)
Hm, it looks like Wunderlist have changed the encoding of their exports. Could you try replacing lines 13 and 14:
with open(input_file) as wunderlist_raw:
wunderlist = json.load(wunderlist_raw)
with:
wunderlist = json.loads(open(input_file).read().decode('utf-8-sig'))
(Based on this)
With wunderlist = json.loads(open(input_file).read().decode('utf-8-sig'))
I got:
wunderlist_to_evernote.py: Using Tasks.json as input
Traceback (most recent call last):
File "wunderlist_to_evernote.py", line 148, in <module>
wunderlist_to_evernote(input_file, output_file)
File "wunderlist_to_evernote.py", line 13, in wunderlist_to_evernote
wunderlist = json.loads(open(input_file).read().decode('utf-8-sig'))
AttributeError: 'str' object has no attribute 'decode'
With wunderlist = json.load(codecs.open(input_file, 'r', 'utf-8-sig'))
I got:
wunderlist_to_evernote.py: Using Tasks.json as input
Traceback (most recent call last):
File "wunderlist_to_evernote.py", line 149, in <module>
wunderlist_to_evernote(input_file, output_file)
File "wunderlist_to_evernote.py", line 18, in wunderlist_to_evernote
for list in wunderlist['data']['lists']:
TypeError: list indices must be integers or slices, not str
I got Python to read the new style of exports using this:
with open(input_file, encoding='utf-8-sig') as wunderlist_raw:
wunderlist = json.load(wunderlist_raw)
Unfortunately they have also restructured the way the export is setup. There used to be separate arrays for tasks, subtasks and list names, but now it is an array of objects where each object is a list with everything else nested therein.
I hope this gives you enough to get started on rewriting my code to match the new export style. I don't actually use Wunderlist anymore, so have no need for this. If you are stuck somewhere in my code, I will of course give you some pointers on how to proceed.
Good luck
I have never dealt with python, so if I can’t just use it by replacing some lines, then I won’t even try to rewrite your code, because I’ll be stuck there for a very long time. Thanks for the help.