Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No module named google #4

Open
ostap-tymchenko opened this issue Jan 8, 2024 · 22 comments
Open

No module named google #4

ostap-tymchenko opened this issue Jan 8, 2024 · 22 comments

Comments

@ostap-tymchenko
Copy link

Hello! I really like the idea of this plugin but I cant get it to work. The issue im getting seems to be something allot the lines of "No module named google"

image

The security token looks like this, Im not sure if I downloaded the right one, as the instructions in the readme are very vague.

obfuscated

System info:

Operating System: Fedora Linux 39
KDE Plasma Version: 5.27.10
KDE Frameworks Version: 5.111.0
Qt Version: 5.15.11
Kernel Version: 6.6.9-200.fc39.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 7640U w/ Radeon 760M Graphics
Memory: 14.8 GiB of RAM
Graphics Processor: AMD Radeon Graphics
Manufacturer: Framework
Product Name: Laptop 13 (AMD Ryzen 7040Series)
System Version: A5

with nvim version:

NVIM v0.9.4
Build type: RelWithDebInfo
LuaJIT 2.1.1692716794
Compilation: /usr/bin/gcc -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wvla -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -fno-common -Wno-unused-result -Wimplicit-fallthrough -fdiagnostics-color=auto -fstack-protector-strong -DUNIT_TESTING -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -I/usr/include/luajit-2.1 -I/usr/include -I/usr/include/luv -I/builddir/build/BUILD/neovim-0.9.4/redhat-linux-build/src/nvim/auto -I/builddir/build/BUILD/neovim-0.9.4/redhat-linux-build/include -I/builddir/build/BUILD/neovim-0.9.4/redhat-linux-build/cmake.config -I/builddir/build/BUILD/neovim-0.9.4/src -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include

system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

@Aadv1k Aadv1k closed this as completed in 872f584 Jan 9, 2024
@Aadv1k Aadv1k reopened this Jan 9, 2024
@Aadv1k
Copy link
Owner

Aadv1k commented Jan 9, 2024

So the apparently the version for google-api-python-client and google_auth_oauthlib seemed to be out of date. I simply ran pip3 install --upgrade and froze the changes to the requirements file. Rest everything looks good on your side

I also want to say thank you for showing interest in this little project of mine. I am unable to frequently update it since I have moved onto using emacs, but I will continue to implement any changes features as issues come up.

I apologize if the documentation was a bit confusing, frankly the whole process of creating credentials is confusing and I found this video https://www.youtube.com/watch?v=j1mh0or2CX8 to be very helpful

@Aadv1k Aadv1k closed this as completed Jan 9, 2024
@ostap-tymchenko
Copy link
Author

I GOT IT TO WORK! Oh man, I was not expecting this to work. My school uses a lot of Google Docs, and hopefully being able to use vim makes things easier. Is there any way currently to downloading and editing existing Google Docs?

@Aadv1k
Copy link
Owner

Aadv1k commented Jan 9, 2024

Hey! glad it worked for you.

Unfortunately no as stated in #2, We are handling the files in a "local-first" manner, eg your local files are associated with their remote counterparts and kept up-to-date. I currently don't see a way to implement this feasably, Some potential options in mind:

  • Ask the user to specify the ID of the document
  • Provide a menu to select the document ids for user

If you have any suggestions I will be happy to continue this discussion. thanks, and have a good day. Cheers!

@ostap-tymchenko
Copy link
Author

Yeah, those sound feasible, is that difficult to implement? Honestly, I would be happy with either of the Implementations.

@Aadv1k
Copy link
Owner

Aadv1k commented Jan 9, 2024

Let me see what I can do!

@Aadv1k Aadv1k reopened this Jan 9, 2024
@ostap-tymchenko
Copy link
Author

Well, let me know if i can help in any way. Most of my experience is in rust python and lua, so not sure I can help, but If you have anything I can do for you I can submit a PR.

@Aadv1k
Copy link
Owner

Aadv1k commented Jan 9, 2024

I really appreciate that Ostap! Will keep that in mind (b ^ ^)b

@ostap-tymchenko
Copy link
Author

Hi, Just call me Ari. As far as i understand, the most important part of the code looks like this:

query = doc_query(creds_path, token_path, gdoc_path)

" Opening
query.open_doc_from_file(target_file_path)

And then everything else is basic logic and different methods on query.
Honestly, I have 0 experience with vim script, so I'm happy I can tell this much.

So what is your plan for how to implement this? I was thinking the simplest way might be a function to open by id + a function to list the most recent X documents in your gdocs with their ids.

Also, theirs a bug where if you save a new gdoc as an empty file it errors out, but saves it, and if you try to write in it in Neovim and save it then it just doesn't work until you add something to the gdoc from the website, I can make a bug report for it later (and probablty make a pr for it if i can figure out a testing env).

@Aadv1k
Copy link
Owner

Aadv1k commented Jan 9, 2024

Alright, Done! I added a new command :Gdoc fetch-doc, it can be used like so

:Gdoc fetch-doc 1_mfbkR3FQeAaqEbDuqggk7j1RyS9hHeyeftBRXMCwrA and it will load the document with the id, put it in the current buffer, SAVE the current buffer and then add it to .gdoc hence you will be able to perform all the other actions on it

@Aadv1k Aadv1k closed this as completed Jan 9, 2024
@ostap-tymchenko
Copy link
Author

Oh man that was fast. How do you get the id of a google doc?

@Aadv1k
Copy link
Owner

Aadv1k commented Jan 9, 2024

image

I got it from the URL bar, it looked like the most straightforward approach, atleast for now

@ostap-tymchenko
Copy link
Author

Makes sense. Is it working on your end? For me when I try to download one I get this:
image
And when I try to do something like write I get this:
image

@Aadv1k
Copy link
Owner

Aadv1k commented Jan 9, 2024

Well, embarassing as it is, I messed up. In my haste I apparently messed up some white-space indentation. You may wanna run PlugUpdate sorry! (if that doesn't work, try re-instaling the plugin completely, I really apologize for the mess-up, hope you understand)

@Aadv1k Aadv1k reopened this Jan 9, 2024
@Aadv1k
Copy link
Owner

Aadv1k commented Jan 9, 2024

Yeah, that seemed like the only issue. It seems I have gotten a bit rusty in vimscript! I might develop something similar for emacs too 🤔

@ostap-tymchenko
Copy link
Author

Hey, Im still getting errors when I try to write:
image

Or when fetching:
image

I tried a few different docs and the id is defenetly right.

Is it working for you?

@Aadv1k
Copy link
Owner

Aadv1k commented Jan 9, 2024

well, I don't know what's going on. I assume you have already set

vim.g.path_to_creds = '~/.vim/credentials.json'
vim.g.gdoc_file_path = '~/.vim/' 
vim.g.token_directory = '~/.vim/'

(I am using lua so bit different)

In thase case, I would fully remove the package (comment the line out, clean the directory, re-install) if that doesn't help either then let me know. currently it does work on my end

@ostap-tymchenko
Copy link
Author

can i see how you did it with lua? atm i just have it as vim code in a lua file. I have to go deal with other things now but later I can reset it and say how it turns out.

@Aadv1k
Copy link
Owner

Aadv1k commented Jan 9, 2024

What I mean, is if you are using vim-plug you want to first remove the Plug 'aadv1k/gdoc.vim' line, then run PlugClean, then re-add the line.

I think I miscommunicated, this is my config. I use both vim, and neovim hence slightly differnt configs.

let g:path_to_creds = '~/.vim/credentials.json'
let g:gdoc_file_path = '~/.vim/'
let g:token_directory = '~/.vim/'

rest everything is as-it-is

@ostap-tymchenko
Copy link
Author

This is my setup, Does this look right? Im reinstalling the extention now.
image

@ostap-tymchenko
Copy link
Author

Im still getting issues. Is it possible for you to reinstall the extension and see if it is working?
What I tried: "Gdoc fetch-doc ID" in a blank doc. Result:
image
Gdoc write:
image

@Aadv1k
Copy link
Owner

Aadv1k commented Jan 9, 2024

Well you are right, it does crash. removing the .gdoc fixes the :Gdoc write crash. The issue seems to be in some kind of a mismatch in the ids and the files

Now as for being unable to fetch, make sure the document id you are picking up is created under the same account you gave the OAuth access with, I made this mistake and was stuck.

Again, I am on this issue and will try my best to fix it as soon as I can. Let me know if that works

@Aadv1k
Copy link
Owner

Aadv1k commented Jan 9, 2024

This is my setup, Does this look right? Im reinstalling the extention now. image

Yes looks good, a side-note if you are using lua, you can simply set variables like vim.g for global variables and vim.opt for options such as vim.opt.numbers = true just a quick tip :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants