claytron / ever2simple

Migrate from evernote to simplenote with markdown formatting
176 stars 50 forks source link

Error on converting #6

Open kidata opened 8 years ago

kidata commented 8 years ago

When i try this with Python 2.7.2 on Windows 7 64bit with a fresh exported .enex file:

ever2simple Evernote.enex -o simplenote -f dir

i get this error:

Traceback (most recent call last): File "D:\tools\Python27\Scripts\ever2simple-script.py", line 9, in load_entry_point('ever2simple==2.0', 'console_scripts', 'ever2simple')() File "d:\tools\python27\lib\site-packages\ever2simple\core.py", line 21, in main converter.convert() File "d:\tools\python27\lib\site-packages\ever2simple\converter.py", line 80, in convert notes = self.prepare_notes(xml_tree) File "d:\tools\python27\lib\site-packages\ever2simple\converter.py", line 52, in prepare_notes note_dict['createdate'] = created_string.strftime(self.date_fmt) ValueError: Invalid format string

the format of the created-nodes is 20160324T131701Z in my enex file

planetahuevo commented 8 years ago

Same error when trying to convert a recent exported file.

HoaXHoang commented 8 years ago

exact same for me, on python 2.7.6, win 7 64bit. I guess everyone is moving to simplenote after the announcement lol

HoaXHoang commented 8 years ago

hi, if you want to fix the date string error, just change line 16 in converter.py from date_fmt = '%h %d %Y %H:%M:%S' to date_fmt = '%Y %m %d %H:%M:%S'

sorry still new to git and what the procedure is for submitting fixes

My date is also in this format: 20160629T084212Z. Maybe Evernote exports the date in different formats. Also not sure if this date is even kept anywhere in the text file, so I guess it really doesn't matter what the date is?

AmedeeBulle commented 8 years ago

The problem is that %h is not a valid python strftime(); %bshould be used instead. It works on unix boxes (Linux, Mac,...) because python passes the string to strftime() from the C library which supports %h as synonym for %b

Date actually matters if you want to keep your dates in Simplenote...

(Submitted Pull Request #10 with this small change)

planetahuevo commented 8 years ago

@AmedeeBulle But the other fix suggested changes the order of the year and month. Does your solution fix this too?

Thanks

AmedeeBulle commented 8 years ago

Yes it doesn't matter, it only affects how dates are printed, not read.

(Furthermore it is only used if you select JSON output format, and it that case a UNIX timestamp might be better, see my pull requests #11 and #12 )

planetahuevo commented 8 years ago

Fantastic. Thank you!

DaKine26-2 commented 8 years ago

My first usage yesterday was a complete success, thanks in particular to @hxnhng for the comment about the date_fmt.

Now......since I just converted a few hundred notes, if only there were a way to automate the tagging. I guess there's nothing in simplenote that allows this in the note or filename, etc., right? The reason I ask is that I was planning to export by tag in evernote, so at import time I would know the tag to use for each note.

AmedeeBulle commented 8 years ago

Tags should not be an issue if you go through the JSON path...

What I was missing was the Notebooks as this does no exist in Simplenote. So I exported by notebook and uploaded in Simplenote adding a tag for each notebook.

DaKine26-2 commented 8 years ago

Thanks, will try JSON for the next batch.

planetahuevo commented 8 years ago

Hi, @AmedeeBulle how do you import the json into the simplenote?

Thanks

AmedeeBulle commented 8 years ago

Just using the Simplenote API -- wrote a small script which reads back the JSON file and uploads to Simplenote.

I did that because:

I can share the code if anybody is interested...

DaKine26-2 commented 8 years ago

I can share the code if anybody is interested...

+1, thanks, your script (and ever2simple fork) worked perfectly for me.

planetahuevo commented 8 years ago

I am too. Thanks!

AmedeeBulle commented 8 years ago

Here it is... https://gist.github.com/AmedeeBulle/fdc19b9705a5a9e2f9fc41792dee6901