notes-import icon indicating copy to clipboard operation
notes-import copied to clipboard

Walkthrough

Open Drearyness opened this issue 1 year ago • 15 comments

Hi, I have a NoteStore.sqlite file from an old laptop. However, I am not tech savvy enough to get through all the steps and get the data. I always get stuck at some point and I don't know how to do it.

Could someone walk me through while in chat with me to help me recover data? That would be very helpful to me. Thank you in advance.

Drearyness avatar Mar 04 '24 19:03 Drearyness

I am an IT consultant, of course I could sell you 1h of my time, but I don't think you want this.

Solving this is very easy:

  • Install git (for windows command line eg here: https://git-scm.com/download/win, for Mac and Windows GUI application eg here: https://www.atlassian.com/software/sourcetree). This step is not necessary if you just download the source.
  • Clone or download the source. Press the "Source" button on https://github.com/ChrLipp/notes-import to see your options.
  • When you choose download you have to unpack the zip file
  • You should have an input directory in your source directory
  • Copy your database file into the input directory and rename it to NoteStore.sqlite
  • Execute the command "./gradlew runScript" in your command line (prior cd to the source directory)

ChrLipp avatar Mar 05 '24 10:03 ChrLipp

Thank you so much for your response! If I end up being incapable, then I wouldn't mind paying for your help.

I am on macOS M3 btw. Getting the notes-import-master folder and adding NoteStore.sqlite into the input folder are easy for me. Executing the command is also easy, but then the issues start. First I did not have Java installed, I tried installing Oracle Java 8 which resulted in an error but installing JDK 21 worked. However.

I ran the command again and got this error:

FAILURE: Build failed with an exception.

* Where:
Settings file '/Users/user/Documents/NoteStore/notes-import-master/settings.gradle'

* What went wrong:
Could not compile settings file '/Users/user/Documents/NoteStore/notes-import-master/settings.gradle'.
> startup failed:
  General error during semantic analysis: Unsupported class file major version 65

  java.lang.IllegalArgumentException: Unsupported class file major version 65

[bunch of lines]

 1 error


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Then I tried with JDK 17 and got this error:

java.lang.IllegalArgumentException: Unsupported class file major version 61

I tried installing 15 through this website https://knasmueller.net/how-to-install-java-openjdk-15-on-macos-catalina but I wasn't able to and ended up getting this error when I pull the version:

exec failed: Error Domain=NSPOSIXErrorDomain Code=86 "Bad CPU type in executable" UserInfo={NSLocalizedFailureReason=Failed to execute /Library/Java/JavaVirtualMachines/jdk-15.jdk/Contents/Home/bin/java: Bad CPU type in executable}

Any idea how I should continue? Thank you @ChrLipp

Edit: okay I just noticed this: https://github.com/ChrLipp/notes-import?tab=readme-ov-file#tested-with. So I guess I'll try if I can get the 15.0.1 to work. Nvm, same issue for 15.0.1. I'm not tech savvy enough to figure out what to do now honestly :').

Drearyness avatar Mar 05 '24 15:03 Drearyness

Ok, I developed this with Java 15, as you already found out.

Next, see https://www.digitalocean.com/community/tutorials/bad-cpu-type-in-executable-fixed It seems that you installed Java for the wrong processor.

Following the link you provided for Java 15, I find: sudo mv openjdk-15_osx-x64_bin.tar.gz So you clearly installed x64 instead of the M3 version

ChrLipp avatar Mar 05 '24 16:03 ChrLipp

Unfortunately it seems like Java 15 doesn't exist for this processor. Only from 17 onwards there is a Mac version for AArch64: https://jdk.java.net/archive/. Thank you for your help. I might try a virtual machine or something.

Drearyness avatar Mar 05 '24 16:03 Drearyness

Give me one day.

ChrLipp avatar Mar 05 '24 17:03 ChrLipp

Try again.

ChrLipp avatar Mar 05 '24 20:03 ChrLipp

Try again.

Thank you for your efforts. I'm now running into this issue. It also mentioned something about being incompatible with Gradle 9.0.

> Task :runScript FAILED
Exception in thread "main" java.io.FileNotFoundException: output/[note folder name]/[note information].txt (No such file or directory)
        at java.base/java.io.FileOutputStream.open0(Native Method)
        at java.base/java.io.FileOutputStream.open(FileOutputStream.java:289)
        at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:230)
        at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:179)
        at org.codehaus.groovy.runtime.ResourceGroovyMethods.write(ResourceGroovyMethods.java:893)
        at org.codehaus.groovy.runtime.ResourceGroovyMethods.write(ResourceGroovyMethods.java:783)
        at org.codehaus.groovy.runtime.ResourceGroovyMethods.write(ResourceGroovyMethods.java:767)
        at org.codehaus.groovy.runtime.ResourceGroovyMethods.setText(ResourceGroovyMethods.java:796)
        at org.codehaus.groovy.runtime.dgm$1141.doMethodInvoke(Unknown Source)
        at org.codehaus.groovy.reflection.GeneratedMetaMethod$Proxy.doMethodInvoke(GeneratedMetaMethod.java:87)
        at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:2893)
        at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:3912)
        at org.codehaus.groovy.runtime.InvokerHelper.setProperty(InvokerHelper.java:194)
        at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.setProperty(ScriptBytecodeAdapter.java:502)
        at notes$_writeEntries_closure1.doCall(notes.groovy:63)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:328)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:279)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1007)
        at groovy.lang.Closure.call(Closure.java:433)
        at groovy.lang.Closure.call(Closure.java:422)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2200)
        at org.codehaus.groovy.runtime.dgm$202.doMethodInvoke(Unknown Source)
        at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321)
        at notes.writeEntries(notes.groovy:50)
        at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321)
        at notes.run(notes.groovy:20)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:328)
        at groovy.lang.MetaClassImpl.doInvokeMethod(MetaClassImpl.java:1333)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1088)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1007)
        at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:645)
        at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:628)
        at org.codehaus.groovy.runtime.InvokerHelper.runScript(InvokerHelper.java:422)
        at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321)
        at notes.main(notes.groovy)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':runScript'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk-21.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.6/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 44s
3 actionable tasks: 3 executed

Edit: after the above I installed Gradle with Homebrew command and I ran the script again, but it gave the same error. This is the Gradle version:


------------------------------------------------------------
Gradle 8.6
------------------------------------------------------------

Kotlin:       1.9.20
Groovy:       3.0.17
Ant:          Apache Ant(TM) version 1.10.13 compiled on January 4 2023
JVM:          21.0.2 (Homebrew 21.0.2)
OS:           Mac OS X 14.1 aarch64

For Java:

java -version
java version "21.0.2" 2024-01-16 LTS
Java(TM) SE Runtime Environment (build 21.0.2+13-LTS-58)
Java HotSpot(TM) 64-Bit Server VM (build 21.0.2+13-LTS-58, mixed mode, sharing)

Drearyness avatar Mar 06 '24 06:03 Drearyness

I ran ./gradlew --warning-mode=all for you:

> Configure project :
Build file '/Users/user/Documents/NoteStore/notes-import-master/build.gradle': line 23
The org.gradle.api.plugins.JavaPluginConvention type has been deprecated. This is scheduled to be removed in Gradle 9.0. Consult the upgrading guide for further information: https://docs.gradle.org/8.6/userguide/upgrading_version_8.html#java_convention_deprecation
        at build_cvt06qhd2wn9s50py8cv9it93.run(/Users/user/Documents/NoteStore/notes-import-master/build.gradle:23)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)
Build file '/Users/user/Documents/NoteStore/notes-import-master/build.gradle': line 23
The org.gradle.api.plugins.Convention type has been deprecated. This is scheduled to be removed in Gradle 9.0. Consult the upgrading guide for further information: https://docs.gradle.org/8.6/userguide/upgrading_version_8.html#deprecated_access_to_conventions
        at build_cvt06qhd2wn9s50py8cv9it93.run(/Users/user/Documents/NoteStore/notes-import-master/build.gradle:23)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)
Build file '/Users/user/Documents/NoteStore/notes-import-master/build.gradle': line 24
The org.gradle.api.plugins.JavaPluginConvention type has been deprecated. This is scheduled to be removed in Gradle 9.0. Consult the upgrading guide for further information: https://docs.gradle.org/8.6/userguide/upgrading_version_8.html#java_convention_deprecation
        at build_cvt06qhd2wn9s50py8cv9it93.run(/Users/user/Documents/NoteStore/notes-import-master/build.gradle:24)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)
Build file '/Users/user/Documents/NoteStore/notes-import-master/build.gradle': line 24
The org.gradle.api.plugins.Convention type has been deprecated. This is scheduled to be removed in Gradle 9.0. Consult the upgrading guide for further information: https://docs.gradle.org/8.6/userguide/upgrading_version_8.html#deprecated_access_to_conventions
        at build_cvt06qhd2wn9s50py8cv9it93.run(/Users/user/Documents/NoteStore/notes-import-master/build.gradle:24)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)

Drearyness avatar Mar 06 '24 06:03 Drearyness

We have here a Gradle warning which you can ignore. When using /gradlew runScript as commented in the readme, the wrapper installs the given version (defined in gradle/wrapper/gradle-wrapper.properties ), your already installed versions are ignored. So it works regardless Gradle is installed on your system or not.

The error is in the program logic, so the application is executed. The program wants to create this file: output/[note folder name]/[note information].txt and is not able to (even if this is a valid path and the output folder should already exist).

Since I tested the application with my sqlite db, I am afraid I can't help you any further without having your sqlite db. Of course I could provide a version which just logs the content or skips incorrect or wrong handled data records.

Updated, try again. The new logic ignores entries which produce an error, but logs them.

ChrLipp avatar Mar 06 '24 14:03 ChrLipp

Awesome @ChrLipp that worked. Amazing. Thank you so much.

I did get quite a few errors, but it seems like those are not really important notes anyway.

21:03:53.697 [main] ERROR notes -- Reason  : java.io.FileNotFoundException: output/folder/subfolder/7110 - X.txt (No such file or directory)
21:03:53.697 [main] ERROR notes -- --------------------------------
21:03:53.697 [main] ERROR notes -- Could not write note!
21:03:53.697 [main] ERROR notes -- Filename: 7111 - X
21:03:53.697 [main] ERROR notes -- Content : X

Once again, thank you :)

Drearyness avatar Mar 06 '24 17:03 Drearyness

You are welcome! You can import them manually, you have to check the logs carefully. If it is to much work we can go into the details.

BTW you are reading the logs wrong. The order per entry is:

  • Could not write note!
  • Filename:
  • Content:
  • Reason:
  • and at the end the line with the -

When looking at your example I never knew that it is possible to have folders in folders.

But when everything is ok, I will close this issue. Glad I could help!

ChrLipp avatar Mar 06 '24 18:03 ChrLipp

How would I go about importing them manually?

The weird thing is that those notes with errors do seem to be displaying the content on terminal. So there's an error, it doesn't reach the output folder, but the info is in terminal? Is that right?

Drearyness avatar Mar 07 '24 05:03 Drearyness

Yes. If I am able, I store it in the output folder. If there is an error and I cannot store it, I display it on the terminal. You can take it from the terminal and store it in a file manually.

ChrLipp avatar Mar 07 '24 07:03 ChrLipp

Okay great, understood. Then I have all information from my database and I thank you a lot for your time and effort!

Drearyness avatar Mar 07 '24 07:03 Drearyness

Hi @ChrLipp , hope you're well.

This issue https://github.com/ChrLipp/notes-import/issues/4#issuecomment-1980179742 is back again when using a database from macOS Monterey.

Let me know if you need more info.

Drearyness avatar Aug 19 '24 07:08 Drearyness