ndbeals / keep-exporter

A command line utility to export Google Keep notes to markdown.
https://pypi.org/project/keep-exporter/
BSD 3-Clause "New" or "Revised" License
96 stars 1 forks source link

How to run? #15

Closed chaoscreater closed 3 years ago

chaoscreater commented 3 years ago

I've tried to follow the instructions as best as I can, but can't figure out how to get this working.

First of all, the instructions mentions this file "keep_export", but it's not found in any of the folders.

I've got poetry installed and ran poetry build to build the wheel and everything during the install process went OK. I can't just figure out how to run. I tried running the export.py file and initially I got a click-config-file module missing error. I fixed that by doing pip3 install click-config-file and then I tried again and I got no more errors, but nothing happens when I ran the export.py file.

I've got nothing like what is mentioned in the help file.

mbafford commented 3 years ago

If you're not really comfortable with Python or familiar with the ecosystem, pipx might be a better way of installing - it sets up a self-contained virtual environment, downloads the package, installs dependencies, and sets up your path for you.

$ pip3 install pipx
$ pipx ensurepath 

then:

$ pipx install keep-exporter
$ pipx inject keep-exporter requests===2.23.0  # not sure if this step is still needed
$ keep_export

I don't use poetry often, so I'm not 100% for the poetry steps, but I did just test:

$ cd keep-exporter
$ poetry install
$ poetry build

This creates the files in dist/ that the README references, so then you can do:

pip3 install dist/keep_exporter-*.whl

(it seems like you successfully did all of that)

This installs all of the relevant dependencies and adds the keep_export script to the same path as pip3, so you should just be able to run keep_export with no path:

$ keep_export
User:

It should be in the same folder as pip3.

keep_export is only generated as part of the build/install process. Again, if the build and install went fine, it should be right beside pip3 in your filesystem.

chaoscreater commented 3 years ago

Thanks. I ran keep_export just now and it is prompting for my username etc. I initially thought that keep_export is a python file and couldn't find it in the folder, but it makes sense now.

I did a test run just now and can see my Google Keep notes in the project folder now. I can also see a config generated with all my Google Keep credentials in there.

I tried to run keep_exporter -config pathToConfigFile and it doesn't seem to understand the -config parameter. I tried --config and it didn't work either.

When I ran keep_exporter -h, it just shows this without an option to specify the config?


Usage: keep_export [OPTIONS]

  A simple utility to export google keep notes to markdown files with metadata stored as a frontmatter header.

Options:
  -u, --user TEXT            Google account email (prompt if empty)  [env var: GKEEP_USER; required]
  -p, --password TEXT        Google account password (prompt if empty)  [env var: GKEEP_PASSWORD; required]
  -d, --directory DIRECTORY  Output directory for exported notes  [default: ./gkeep-export]
  --header / --no-header     Choose to include or exclude the frontmatter header  [default: True]
  -h, --help                 Show this message and exit.

I'd like to run this as a scheduled task and so if I can get this working, that would be great.

NVM, I can just specify the username and password in the same line as keep_exporter and it'll work. Not too sure why it creates the config file and you can't reference or use it...

mbafford commented 3 years ago

You can use the config file, but it's not mentioned in the help.

keep_export --config /path/to/keep-exporter-config.yaml

or another way of running using poetry without installing the wheel/.whl file:

poetry run keep_exporter/export.py --config /path/to/keep-exporter-config.yaml

As for the location of the files - my config has, e.g.:

directory = "/path/to/export/gkeep-export/"
rename_local = True
delete_local = True

It seems like you're running on Windows? I'm not sure if there are differences that are causing issues - unfortunately I'm not really able to help troubleshoot too much on Windows.

ndbeals commented 3 years ago

Cheers @mbafford, Really appreciate you answering this (just saw this issue too).

mbafford commented 3 years ago

@ndbeals No problem!

@chaoscreater I'm going to close this now, but I'm happy to try to help further if you're still having issues. Just let us know if you're having any remaining issues and any supporting details so we can help troubleshoot.