da-h / AirLatex.vim

Overleaf / ShareLatex in Vim
MIT License
79 stars 8 forks source link

'NoneType' object has no attribute 'encode' #31

Closed eqimd closed 3 years ago

eqimd commented 3 years ago

After installing the plugin with Neovim and Vim Plug and running :AirLatex, it gives error " 'NoneType' object has no attribute 'encode' ". Maybe I don't have some python dependencies installed? (except for those specified in the readme)

da-h commented 3 years ago

Short questions:

Best da-h

eqimd commented 3 years ago

Yes, I re-installed the plugin but nothing happened. I'm starting nvim from home folder and it doesn't create file AirLatex.log. I tried to do it in new folder, but it didn't help. And because I can't show the complete error message. Maybe there is another way? Minimal init.vim:

call plug#begin('~/.vim/plugged')

Plug 'da-h/AirLatex.vim', {'do': ':UpdateRemotePlugins'}

call plug#end()

let g:AirlatexDomain="www.overleaf.com"

scr

da-h commented 3 years ago

I have indeed forgotten some of the python packages that are required. I have just adapted the Readme.md to contain the missing requirements.

To let AirLatex generate the AirLatex.log files, please add let g:AirLatexLogLevel="DEBUG" to your vimrc file. (I forgot to mention this, sorry).

However, I am still unsure about this error. What python version are you currently using?

eqimd commented 3 years ago

So, I have requests and pynvim installed, I thought maybe there are some other dependencies, but apparently not. I'm using Python 3.8.5. version. There's logs:

[DEBUG] airlatex.session #54: (Thread-1  ) login()
[DEBUG] airlatex.session #69: (Thread-1  ) Checking Browser 'auto' for Cookies at directory ''.
[ERROR] airlatex.session #22: (Thread-1  ) 'NoneType' object has no attribute 'encode'
Traceback (most recent call last):
  File "/home/eqimd/.vim/bundle/AirLatex.vim/rplugin/python3/airlatex/session.py", line 20, in wrapped
    return fn(self, nvim, *args, **kwargs)
  File "/home/eqimd/.vim/bundle/AirLatex.vim/rplugin/python3/airlatex/session.py", line 72, in login
    self.cj = browser_cookie3.load(cookiedir)
  File "/home/eqimd/.local/lib/python3.8/site-packages/browser_cookie3/__init__.py", line 626, in load
    for cookie in cookie_fn(domain_name=domain_name):
  File "/home/eqimd/.local/lib/python3.8/site-packages/browser_cookie3/__init__.py", line 592, in chrome
    return Chrome(cookie_file, domain_name, key_file).load()
  File "/home/eqimd/.local/lib/python3.8/site-packages/browser_cookie3/__init__.py", line 382, in __init__
    super().__init__(browser='Chrome', cookie_file=cookie_file, domain_name=domain_name, key_file=key_file, **args)
  File "/home/eqimd/.local/lib/python3.8/site-packages/browser_cookie3/__init__.py", line 190, in __init__
    self.__add_key_and_cookie_file(**kwargs)
  File "/home/eqimd/.local/lib/python3.8/site-packages/browser_cookie3/__init__.py", line 212, in __add_key_and_cookie_file
    my_pass = get_linux_pass(os_crypt_name)
  File "/home/eqimd/.local/lib/python3.8/site-packages/browser_cookie3/__init__.py", line 142, in get_linux_pass
    my_pass = keyring.get_password(
AttributeError: 'NoneType' object has no attribute 'encode'
eqimd commented 3 years ago

So...I solved the problem ;) I noticed that browser_cookie3 tries to load cookie from Chrome, but I didn't have Chrome, only Firefox. So, I installed Chrome, but nothing happened again. Later, I logged in on oveleaf.com (on Chrome, I've been already logged in on Firefox) and now the plugin doesn't show the error message and it works as well. I think it's kinda browser_cookie3 problems, and we should have an option to set another browser for cookies. Think this should be described in Readme.md.

da-h commented 3 years ago

Hi!

I just reproduced your error using Chromium Browser (I was using Firefox for testing).

It seems like for chromium, browser_cookie3 fails to retrieve the cookie file & encryption keys. However, I could not manage to configure the tool for chromium, yet.

da-h commented 3 years ago

Great, you solved the problem. 😅

Maybe I should switch directly to a keyring instead and let AirLatex do the login itself.

eqimd commented 3 years ago

But the problems doesn't end there :) May I have your email or telegram or something to contact? Think creating new issues for all new problems isn't a good idea.

da-h commented 3 years ago

Sure, go ahead! The issues on github are somewhat a project specific todo list for me.

I am very happy to receive help from users in the form of issues/feature requests. I would very much like to at least make this project usable / bring it out of WIP status.