nvbn / everpad

Evernote client well integrated with linux desktop
1.17k stars 143 forks source link

everpad-provider: TypeError: __init__() got an unexpected keyword argument 'http_proxy' #394

Open e2jk opened 10 years ago

e2jk commented 10 years ago

I've installed Everpad from the PPA 3 days ago, and since yesterday Everpad doesn't sync anymore. I believe (can't assure/remeber 100%) that this started to happen when I instructed Everpad to Start with system.

I'm using Ubuntu 12.04, the version I installed throught the PPA is 2.5.7-0~precise. When opening my session, I get this Ubuntu crash report window:

everpad crash

If I killall everpad everpad-provider everpad-lens and then run everpad-provider from the command line, I get the following traceback:

emilien@galileo:~$ everpad-provider --verbose
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/everpad/provider/sync.py", line 454, in run
    self.init_network()
  File "/usr/lib/pymodules/python2.7/everpad/provider/sync.py", line 470, in init_network
    self.note_store = get_note_store(self.auth_token)
  File "/usr/lib/pymodules/python2.7/everpad/provider/tools.py", line 64, in get_note_store
    user_store = get_user_store(auth_token)
  File "/usr/lib/pymodules/python2.7/everpad/provider/tools.py", line 56, in get_user_store
    http_proxy=get_proxy_config(urlparse(user_store_uri).scheme))
TypeError: __init__() got an unexpected keyword argument 'http_proxy'

I am not behind any kind of proxy or vpn.

Doing a bit of investigation: The call that goes wrong is in get_user_store, in the file everpad/provider/tools.py:

user_store_http_client = THttpClient.THttpClient(user_store_uri,
            http_proxy=get_proxy_config(urlparse(user_store_uri).scheme))

It passes to the init of THttpClient.THttpClient (class imported from thrift.transport) a parameter called http_proxy.

i've located thrift.transport on my system:

emilien@galileo:~$ locate THttpClient
/usr/lib/pymodules/python2.7/thrift/transport/THttpClient.py
/usr/lib/pymodules/python2.7/thrift/transport/THttpClient.pyc
/usr/local/lib/python2.7/dist-packages/evernote-1.25.0-py2.7.egg/thrift/transport/THttpClient.py
/usr/local/lib/python2.7/dist-packages/evernote-1.25.0-py2.7.egg/thrift/transport/THttpClient.pyc
/usr/share/pyshared/thrift/transport/THttpClient.py

This is the init of THttpClient for the different files:

/usr/local/lib/python2.7/dist-packages/evernote-1.25.0-py2.7.egg/thrift/transport/THttpClient.py
    def __init__(
        self,
        uri_or_host,
        port=None,
        path=None,
        proxy_host=None,
        proxy_port=None
    ):
/usr/share/pyshared/thrift/transport/THttpClient.py
  def __init__(self, uri_or_host, port=None, path=None, http_proxy=None):

(and /usr/lib/pymodules/python2.7/thrift/transport/THttpClient.py is symlinked to /usr/share/pyshared/thrift/transport/THttpClient.py so it's the same content)

So the version of thrift that is included with evernote-1.25.0-py2.7.egg does not have a parameter called http_proxy, causing this issue. I assume that if the Thrift version that is packaged separately for Ubuntu/Debian was used (see #382) this would not happen?

Is Everpad including an old (or newer?) version of Thrift, which does not have this http_proxy argument?

I've seen quite a few issues reporting not being able to sync, I've read through them but they all seem to be related to other causes (output of everpad-provider --verbose showing that it does sync at least some notebooks, etc.)

e2jk commented 10 years ago

EDIT: removed unnecessary details.

I've renamed the folder /usr/local/lib/python2.7/dist-packages/evernote-1.25.0-py2.7.egg/thrift/ to something else, and now it's syncing correctly!

e2jk commented 10 years ago

Is it possible to remove the thrift code from Everpad's source code, and use the Ubuntu/Debian packaged version instead?

nvbn commented 10 years ago

Is it possible to remove the thrift code from Everpad's source code, and use the Ubuntu/Debian packaged version instead?

No, packaged version of thrift not work with evernote ssl certificates.

e2jk commented 10 years ago

Le 18 janv. 2014 22:58, "Vladimir Iakovlev" notifications@github.com a écrit :

Is it possible to remove the thrift code from Everpad's source code, and use the Ubuntu/Debian packaged version instead?

No, packaged version of thrift not work with evernote ssl certificates.

Well, for me it did, after I removed the Thrift package that came with Ever pad, it synced all fine, instead of throwing this Exception...

e2jk commented 10 years ago

I'm confused, and not sure what is going on:

https://github.com/nvbn/everpad/blob/develop/everpad/provider/tools.py#L45:

    user_store_http_client = THttpClient.THttpClient(user_store_uri,
            http_proxy=get_proxy_config(urlparse(user_store_uri).scheme))

And from https://github.com/nvbn/everpad/blob/develop/thrift/transport/THttpClient.py#L36

  def __init__(self, uri_or_host, port=None, path=None, http_proxy=None):

So in the repository, the init() for the THttpClient class from the everpad-included Thrift correctly has the http_proxy argument. But, as mentioned in the original post, what I have on my local machine installed at /usr/local/lib/python2.7/dist-packages/evernote-1.25.0-py2.7.egg/thrift/transport/THttpClient.py (and I'm assuming this file, in the folder called "evernote-1.25.0-py2.7.egg", comes from Everpad?) does not have that http_proxy argument:

    def __init__(
        self,
        uri_or_host,
        port=None,
        path=None,
        proxy_host=None,
        proxy_port=None
    ):

Any idea what that file is, or where it comes from? Is there something wrong with the package for Ubuntu 12.04? It seems this doesn't affect all users ;) Or is "/usr/local/lib/python2.7/dist-packages/evernote-1.25.0-py2.7.egg" not provided by the Everpad package from the PPA?

mcg commented 9 years ago

Having a similar issue with everpad in 15.04 using the PPA.

/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py:1224: UserWarning: /home/mcg/.python-eggs is writable by group/others and vulnerable to attack when used with get_resource_filename. Consider a more secure location (set with .set_extraction_path or the PYTHON_EGG_CACHE environment variable).
  warnings.warn(msg, UserWarning)
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/everpad/provider/sync.py", line 454, in run
    self.init_network()
  File "/usr/lib/pymodules/python2.7/everpad/provider/sync.py", line 470, in init_network
    self.note_store = get_note_store(self.auth_token)
  File "/usr/lib/pymodules/python2.7/everpad/provider/tools.py", line 64, in get_note_store
    user_store = get_user_store(auth_token)
  File "/usr/lib/pymodules/python2.7/everpad/provider/tools.py", line 56, in get_user_store
    http_proxy=get_proxy_config(urlparse(user_store_uri).scheme))
TypeError: __init__() got an unexpected keyword argument 'http_proxy'
luisdavim commented 8 years ago

To fix it I had to edit /usr/lib/pymodules/python2.7/everpad/provider/tools.py and remove

 ,
            http_proxy=get_proxy_config(urlparse(user_store_uri).scheme)

from lines 56 and 67