enex is zero

Jun 8, 2011 at 11:08 AM

I have a comkputer running Windows XP Pro with lots of RAM and HD space.

 

I have python 2.7.1 installed in C:\python27

 

your instructions say a two step process is needed.

 

************************

 

a) Either type in the command below from a DOS/Command prompt/window:        c:\python26\python.exe converter.py SampleDatabase Sample.csv  N N N 
       Or edit the MyBatch.cmd file.               Be sure and change the name of the directory to where you have        Python installed: 

 


 b) Open a DOS/Command window and enter the following: 
          convert XXXXXX PhatNotes_2011_08_15_DatabaseNameXX.csv Y Y Y     where the parms are as follows:   1) Database name from PhatNotes - this will automatically create an      evernote tag called PhatNotesDatabase=XXXXXX.       Purpose: If you have several Phatnote databases, this is one way       you can find/separate the notes in EverNote.  Eventually,       you may choose to create an EverNote foler for each PhatNote database.       If you dont' like the name "PhatNotesDatabase=XXXXX", you can edit it      in Evernote after you have uploaded. 

 

I did step a.) and got a enex file with zero bytes. I am converting a phatnotes database note that has data in it.

 

Why do I get a zero byte file?

 

I have all the files in C:\python27 including the phatnotes csv file named test.csv.

 

Coordinator
Jun 8, 2011 at 1:50 PM
Edited Jun 8, 2011 at 1:51 PM

Hi, when perform step A, did you type it the command window directly, or did you use a .bat file? 
If using a .bat file, I'm thinking maybe you should put a "pause" statement at the bottom of the .bat file.  Maybe there was an error that flashed by too quick to read?

For Example, edit the .bat/.cmd file like this:

CONVERT $AFTERLAST_  NEAL_Olexe.csv  N N N
PAUSE

or

python.exe converter.py %1 %2 %3 %4 %5 %6
PAUSE

Is there any chance you have Unicode/special or foreign characters in your PhatNotes file?

Neal

Coordinator
Jun 8, 2011 at 3:18 PM

The "two step" process you mentioned is an "either/or".

There are really three steps:

1) Export Phanotes
2) Run my Python Converter (either .bat file or direct from command prompt)
3) Import into Evernote

I see it is number #2 that is causing you problems.  I think most likely there is an error, but the command prompt window might be closing before you have a chance to read it.

Neal

 

Jun 13, 2011 at 4:04 AM

I have replied twice to your email, but nothing is getting trhrough.

 

This is the exact line I am trying to run that gives me a zero byte enex file.

 

The csv file is test.csv

 

Python 2.7.1 is in C:\phython27

 

 

c:\python27\python.exe converter.py SampleDatabase test.csv  N N N

 

anything else I get nothing.

 

I have now an error that says that says the py file cannot be opened

Coordinator
Jun 13, 2011 at 1:18 PM
Edited Jun 13, 2011 at 1:23 PM

Did you do a change directory like this first?

CD c:\python27

then rerun exactly what you run above.

If you are not in the c:\python27 directory, then you would have to pass a fully qualified name of the test.cv file, for example: C:\python27\test.cv.

If you still have a problem, an exact copy/paste of your DOS/command window would be useful.

Thanks,

Neal

Jun 14, 2011 at 5:25 AM

Same problem.

 

IUt is still a zero byte file.

 

I was and still am in C:\phthon27

 

Here is the copy.

 

Microsoft Windows XP [Version 5.1.2600](C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\Edward Morgan>CD C:\python27
C:\Python27>Microsoft Windows XP [Version 5.1.2600]'Microsoft' is not recognized as an internal or external command,operable program or batch file.
C:\Python27>(C) Copyright 1985-2001 Microsoft Corp.Copyright was unexpected at this time.
C:\Python27>C:\Python27>C:\Documents and Settings\Edward Morgan>cd C:\python27'C:\Documents' is not recognized as an internal or external command,operable program or batch file.
C:\Python27>C:\Python27>C:\Python27>:\python27\python.exe converter.py SampleDatabase test.csv  N N NThe filename, directory name, or volume label syntax is incorrect.
C:\Python27>C:\Python27>:\python27\python.exe converter.py SampleDatabase test.csv  N N NThe filename, directory name, or volume label syntax is incorrect.
C:\Python27>C:\Python27>CC:\python27\python.exe converter.py SampleDatabase test.csv  N N NThe filename, directory name, or volume label syntax is incorrect.
C:\Python27>The filename, directory name, or volume label syntax is incorrect.'The' is not recognized as an internal or external command,operable program or batch file.
C:\Python27>C:\Python27>C:\Python27>C:\python27\python.exe converter.py SampleDatabase test.csv  N N N'C:\Python27' is not recognized as an internal or external command,operable program or batch file.
C:\Python27>Number of args = 6'Number' is not recognized as an internal or external command,operable program or batch file.
C:\Python27>0:converter.pyThe system cannot find the drive specified.
C:\Python27>1:SampleDatabaseThe system cannot find the drive specified.
C:\Python27>2:test.csvThe system cannot find the drive specified.
C:\Python27>3:NThe system cannot find the drive specified.
C:\Python27>4:NThe system cannot find the drive specified.
C:\Python27>5:NThe system cannot find the drive specified.
C:\Python27>===========================================C:\Python27>PARMS:'PARMS:' is not recognized as an internal or external command,operable program or batch file.
C:\Python27>  1) database=SampleDatabase'1)' is not recognized as an internal or external command,operable program or batch file.
C:\Python27>  2) inputCSVFilename=test.csv'2)' is not recognized as an internal or external command,operable program or batch file.
C:\Python27>  3) YNPhatCategory=N'3)' is not recognized as an internal or external command,operable program or batch file.
C:\Python27>  4) YNPhatColor=N'4)' is not recognized as an internal or external command,operable program or batch file.
C:\Python27>  5) YNPhatPriority=N'5)' is not recognized as an internal or external command,operable program or batch file.
C:\Python27>===========================================C:\Python27>C:\Python27>Traceback (most recent call last):'Traceback' is not recognized as an internal or external command,operable program or batch file.
C:\Python27>  File "converter.py", line 124, in <module>The syntax of the command is incorrect.
C:\Python27>    noteTemplateFile = open(noteTemplateFilename,"r")'noteTemplateFile' is not recognized as an internal or external command,operable program or batch file.
C:\Python27>IOError: [Errno 2] No such file or directory: 'EverNote_Template_Note.xml''IOError:' is not recognized as an internal or external command,operable program or batch file.
C:\Python27>C:\Python27>C:\Python27>C:\python27\python.exe converter.py SampleDatabase test.csv  N N N'C:\Python27' is not recognized as an internal or external command,operable program or batch file.
C:\Python27>Number of args = 6'Number' is not recognized as an internal or external command,operable program or batch file.
C:\Python27>0:converter.pyThe system cannot find the drive specified.
C:\Python27>1:SampleDatabaseThe system cannot find the drive specified.
C:\Python27>2:test.csvThe system cannot find the drive specified.
C:\Python27>3:NThe system cannot find the drive specified.
C:\Python27>4:NThe system cannot find the drive specified.
C:\Python27>5:NThe system cannot find the drive specified.
C:\Python27>===========================================C:\Python27>PARMS:'PARMS:' is not recognized as an internal or external command,operable program or batch file.
C:\Python27>  1) database=SampleDatabase'1)' is not recognized as an internal or external command,operable program or batch file.
C:\Python27>  2) inputCSVFilename=test.csv'2)' is not recognized as an internal or external command,operable program or batch file.
C:\Python27>  3) YNPhatCategory=N'3)' is not recognized as an internal or external command,operable program or batch file.
C:\Python27>  4) YNPhatColor=N'4)' is not recognized as an internal or external command,operable program or batch file.
C:\Python27>  5) YNPhatPriority=N'5)' is not recognized as an internal or external command,operable program or batch file.
C:\Python27>===========================================C:\Python27>C:\Python27>Traceback (most recent call last):'Traceback' is not recognized as an internal or external command,operable program or batch file.
C:\Python27>  File "converter.py", line 124, in <module>The syntax of the command is incorrect.
C:\Python27>    noteTemplateFile = open(noteTemplateFilename,"r")'noteTemplateFile' is not recognized as an internal or external command,operable program or batch file.
C:\Python27>IOError: [Errno 2] No such file or directory: 'EverNote_Template_Note.xml''IOError:' is not recognized as an internal or external command,operable program or batch file.
C:\Python27>C:\Python27>C:\Python27>

Coordinator
Jun 14, 2011 at 5:41 AM

1) Did you export your PhatNotes to test.csv?  or what name?

2) What you pasted is not making a lot of sense to me, for example, on the second line of your "copy", it looks like from the c:\Python27 prompt you entered "Microsoft Windows XP" etc... 

3) To what directory did you unzip the files you downloaded from CodePlex?

If you see any errors in the output, then the program failed and you need to resolve the errors.

I see a few errors above such as:

    "No such file or directory: 'Evernote_Template_Note.xml is not recognized... "

     There are three Evernote_Template files that I include in the CodePlex download. 

So does test.csv exist in your c:\python27 directory, as well as the above template files? If so, can you try just typing this as the C:\Python27> prompt

python.exe converter.py SampleDatabase test.csv  N N N

and let me see that output.

Or, for example, if unzipped the CodePlex code to C:\Converter, then try this:

C:\Python\python.exe converter.py SampleDatabase test.csv  N N N

Neal

Jun 14, 2011 at 7:21 AM

 

1) Did you export your PhatNotes to test.csv?  or what name?

 

>>>>>yes. test.csv and it is in C;\phyton27

2) What you pasted is not making a lot of sense to me, for example, on the second line of your "copy", it looks like from the c:\Python27 prompt you entered "Microsoft Windows XP" etc... 

 

>>>>>The DOS prompt did this, not me

3) To what directory did you unzip the files you downloaded from CodePlex?

 

C:\python27

If you see any errors in the output, then the program failed and you need to resolve the errors.

I see a few errors above such as:

    "No such file or directory: 'Evernote_Template_Note.xml is not recognized... "

     There are three Evernote_Template files that I include in the CodePlex download. 

So does test.csv exist in your c:\python27 directory, as well as the above template files? If so, can you try just typing this as the C:\Python27> prompt

 

>>>>>Everything is in C:\python27

python.exe converter.py SampleDatabase test.csv  N N N

and let me see that output.

 

>>>>>Now it says that python.exe is not a valid win 32 file

Or, for example, if unzipped the CodePlex code to C:\Converter, then try this:

C:\Python\python.exe converter.py SampleDatabase test.csv  N N N

Neal

 

Nothing seems to work. I re unzipped the file to C:\python27 and then the error that it is not a valid win 32 file occured.

Coordinator
Jun 14, 2011 at 1:25 PM

Let's start by making sure Python is working.

Please create a file called HelloWorld.py in your c:\Python27 directory.

In it, type the following (using Notepad): 

print "Hello World"

Then from DOS Command prompt, within c:\Python27, type the following:

python.exe HelloWorld.py

Does this work?

Neal

Jun 15, 2011 at 1:38 AM

No it does not.

 

Same error message that it is not a  valid win32 file.

Coordinator
Jun 15, 2011 at 1:57 AM

I just changed my "How technical do you have to be..." verbage on the home page.

It said:

  1. You must be able to install Python on your computer if you don't already have it

and I changed it to:

  1. You must be able to install Python on your computer if you don't already have it, and be able to run a simple "HelloWorld.py" Python program. 

There could be numerous issue with your Python install, and while I know Python, I have also had issues in the past installing it as well, and that's not my area of expertise.
Please try:  http://www.python-forum.org for help to get the HelloWorld program running, then I think you will find my CONVERTER.PY will probably work. 

If you are on a 64-bit machine, I had a problem for which the solution might help:  http://superuser.com/questions/84861/python-install-puts-all-files-libs-in-c-root-directory-windows-7-64-bit

Neal

 

Jun 15, 2011 at 3:57 AM

I always search for the simple solution.

 

I found python 2.6 and the conversion does work.

 

But Evernote cannot import it. It says a header note is missing.

 

Maybe I should not be using 

python.exe converter.py SampleDatabase test.csv  N N N

 

How should I change this to use one of your templates?



I want to send you the test.csv and the test.enex, but this site has no attachment and emails never make it to this site.

Coordinator
Jun 15, 2011 at 4:10 AM
Edited Jun 15, 2011 at 4:10 AM

Wow, I don't know why Pythong 2.6 was better...

If you are running convert.py, then you are using my templates.  The templates could in theory be modified (for example a new release of Evernote), but in general, they shouldn't be touched.

You can send the files to NealWalters@NealWalters.com.   But First...

Here's a sample Enex file that I just tried and it works.  Please save it in a file on your system, and try importing to your Windows version of Evernote. 
I'm on version 4.3.1.4479.

 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE en-export SYSTEM "http://xml.evernote.com/pub/evernote-export.dtd">
<en-export export-date="20110114T053231Z" application="Evernote/Windows" version="4.1">

    <note>
        <title>My Sample Note Title</title>
        <content><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd">
<en-note>Line 1 of my note <br />
Line 2 of my note <br />
Line 3 of my note <br />
</en-note>]]>
        </content>
        <created>20071130T144500</created>
        <updated>20110114T225500</updated>
        <tag>PhatNotesColor=Yellow</tag>
        <note-attributes>
            <subject-date>00001231T000000Z</subject-date>
            <latitude>0.00000000000000</latitude>
            <longitude>0.00000000000000</longitude>
            <altitude>0.00000000000000</altitude>
            <source>PhatNotes</source>
        </note-attributes>
    </note>
</en-export>

 

If this file works, then we need to compare it to one of your notes that got generated.
We can either eye-ball it, or use a side-by-side compare utility such as "Beyond Compare" (has a good 30-day trial), or maybe WinDiff or KDiff. 

If the above file does not work, then we need to check your version of Evernote or some other system config...

Neal

Coordinator
Jun 15, 2011 at 5:29 AM

Thanks for sending me the files.

I tried to import your test.ENEX file, and it says "Could not import notes, error: MISSING_NOTE_TITLE".
Exact errors really do help solve problems faster.

So here is the issue, you have one or more notes fro PhatNotes that don't have a title. 
Three solutions:

1) Assign them a title in Phatnotes, and re-export them, run Convertr.py again, and try to import again.

2) Manually edit the file, and type in a title for every note.

3) Manually edit the file, and remove any notes that do not have titles.

If you know XML, there's no problem editing the file with NotePad or your favorite editor (there are even XML editor called XMLNotepad from Microsoft).
Do a find on <title>.  For example, you have one that looks like this:

<title>When Bought</title>

The fifth <title> has no value, and looks like this:
<title></title>
So if you just type in some letters or words between the opening <title> tag and the closing </title> tag, I think it will work.

However, if you mess-up the XML, you could waste more time. 

I could also change the converter.py program in the future to ignore or show an error on notes that don't have titles... but it's too late for me to try that tonight.

Neal

 

Jun 15, 2011 at 6:44 AM

At least now enex files are not zero.

 

Yoiur files import fine, but mine have a consistent error.

 

Not the title, but



UTF-8 data.

 

I tried to paste a screen shot, but I cannot. I will email it.

Jun 19, 2011 at 2:55 AM

I sent you the csv file, Maybe you want the enex file.

Coordinator
Jun 19, 2011 at 3:41 PM

On line 25 (or 27) of you Enex file, you have a non-ASCII character.  It's the charcter in front of the phrase "In Greater China region".  Just delete it an try again.

In different file editors, it may show up differently (as a space, or a dot or something else).

Maybe I should add a special-character stripper?

Neal

Jun 19, 2011 at 11:19 PM

Yes. I was able to find it. It was an "." on my editor. Innocent enough, but enough to stop the import.

Once I removed it, everything went just fine.

 

Thank you very much for your help. Really. Thank you.

 

However, the file that I sent you had some confidential stuff removed. I thought only innocent lines, but when I added the back and tried to convert the csv file I got an etrror.

value error: need more thyan one value to unpack.

 

I will try and send now the actual error print screen by email.

I tried to paste the error here, but this site does not allow a paste.

 

So two questions:

 

1.    How do I know if an innocent characteur is present in files I want to convert? Is there some way to check before I try to convert?

 

 

2.     What does this new error mean? What did I do adding back some lines? Now I get the error.

 



Coordinator
Jun 19, 2011 at 11:55 PM
Just saw this email too.
The error implies that maybe you messed up the .CSV file, so that a row of the CSV didn't have the expected/required number of items.

What you might want to do is convert to the .ENEX, then edit it. There is a free program called NOTEPAD++ that is a good editor. In it, you can press CNTL-H for the replace screen, click the "Regular Expression" button at the lower left in "Search Mode". Copy this in the "Find what:" box: [\x80-\xFF] and make sure the "Replace with" has nothing in it.
Got this RegEx here: http://stackoverflow.com/questions/3001177/how-do-i-grep-for-non-ascii-characters-in-unix, then click "Replace all" and it will tell you how many it replaced (only one in the file you sent me).

How many notes are you moving over? If 10-20, it might be easier just to copy/paste them. If dozens or hundreds, then my utility would be the only way to go.

I'll paste this same message back to the CodePlex forum so other can know the solution.

Neal


On Sun, Jun 19, 2011 at 4:19 PM, hawaiianlungs <notifications@codeplex.com> wrote:

From: hawaiianlungs

Yes. I was able to find it. It was an "." on my editor. Innocent enough, but enough to stop the import.

Once I removed it, everything went just fine.

Thank you very much for your help. Really. Thank you.

However, the file that I sent you had some confidential stuff removed. I thought only innocent lines, but when I added the back and tried to convert the csv file I got an etrror.

value error: need more thyan one value to unpack.

I will try and send now the actual error print screen by email.

I tried to paste the error here, but this site does not allow a paste.

So two questions:

1. How do I know if an innocent characteur is present in files I want to convert? Is there some way to check before I try to convert?

2. What does this new error mean? What did I do adding back some lines? Now I get the error.



Read the full discussion online.

To add a post to this discussion, reply to this email (ConvertMyNotes@discussions.codeplex.com)

To start a new discussion for this project, email ConvertMyNotes@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Coordinator
Jun 19, 2011 at 11:58 PM

This is the another error that HawaiinLungs sent me:

File "convert.py"  line 155 in <module>
   (subject, created, modified, note, category, authored, color, priority) = row
ValueError:  need more than 1 value to unpack

The error implies that maybe you messed up the .CSV file, so that a row of the CSV didn't have the expected/required number of items.

What you might want to do is convert to the .ENEX, then edit it.  There is a free program called NOTEPAD++ that is a good editor.  In it, you can press CNTL-H for the replace screen, click the "Regular Expression" button at the lower left in "Search Mode".  Copy this in the "Find what:" box: [\x80-\xFF]  and make sure the "Replace with" has nothing in it.
Got this RegEx here: http://stackoverflow.com/questions/3001177/how-do-i-grep-for-non-ascii-characters-in-unix, then click "Replace all" and it will tell you how many it replaced (only one in the file you sent me).

How many notes are you moving over?  If 10-20, it might be easier just to copy/paste them.  If dozens or hundreds, then my utility would be the only way to go.

I'll paste this same message back to the CodePlex forum so other can know the solution.

Neal

Jun 20, 2011 at 3:30 AM

Everything seems to be working now. I imported another Phatnots database.

 

The key is eliminating non-ASCII characteurs from the csv file. They creep in somehow, eventhough I do not consciously put them.

 

The Notepad++ application is very helpful. It allows one to search (grep) the file with Cntrl-H and then search with adding [\x80-\xFF].

 

It will replace any non ASCII symbols with a space.

 

One recent file had 27 such non ASCII symbols and it easily replaced them.

 

The file then easily imported into Evernote.

 

The error was from a bad export from Phatnotes. I just reexported the note and it worked fine.

 

So for now everything is fine.

 

 have hundreds of notes. I travel frequently  and use Phatnotes to hold numbers, addresses, and notes.

 

Now I will convert Phatnotes and look for a conversion program for ListPro.