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

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

Closed
eqimd opened this issue Jan 24, 2021 · 9 comments
Closed

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

eqimd opened this issue Jan 24, 2021 · 9 comments

Comments

@eqimd
Copy link
Contributor

eqimd commented Jan 24, 2021

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
Copy link
Owner

da-h commented Jan 24, 2021

Short questions:

  • If possible, could you please send me the complete error message? Typically there should be a file named AirLatex.log in the folder where you have started nvim.
  • Did you use version I have just pushed to github? (Commit 48fb73f)

Best
da-h

@eqimd
Copy link
Contributor Author

eqimd commented Jan 24, 2021

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
Copy link
Owner

da-h commented Jan 24, 2021

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
Copy link
Contributor Author

eqimd commented Jan 25, 2021

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
Copy link
Contributor Author

eqimd commented Jan 25, 2021

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.

@eqimd eqimd closed this as completed Jan 25, 2021
@da-h
Copy link
Owner

da-h commented Jan 25, 2021

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
Copy link
Owner

da-h commented Jan 25, 2021

Great, you solved the problem. 😅

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

@eqimd
Copy link
Contributor Author

eqimd commented Jan 25, 2021

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
Copy link
Owner

da-h commented Jan 25, 2021

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.

@da-h da-h mentioned this issue Jan 26, 2021
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