Forums

pydrive: TypeError: argument should be integer or bytes-like object, not 'str'

I get this error:

20:46 ~/projects/brawl_stars_api $ python3.8 qwik.py
Traceback (most recent call last):
  File "qwik.py", line 13, in <module>
    file1.Upload() # Upload the file.
  File "/home/0dminnimda/.local/lib/python3.8/site-packages/pydrive/files.py", line 285, in Upload
    self._FilesInsert(param=param)
  File "/home/0dminnimda/.local/lib/python3.8/site-packages/pydrive/auth.py", line 61, in _decorated
    self.auth.Authorize()
  File "/home/0dminnimda/.local/lib/python3.8/site-packages/pydrive/auth.py", line 523, in Authorize
    self.service = build('drive', 'v2', http=self.http)
  File "/usr/lib/python3.8/site-packages/googleapiclient/_helpers.py", line 130, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/usr/lib/python3.8/site-packages/googleapiclient/discovery.py", line 222, in build
    content = _retrieve_discovery_doc(
  File "/usr/lib/python3.8/site-packages/googleapiclient/discovery.py", line 273, in _retrieve_discovery_doc
    resp, content = http.request(actual_url)
  File "/usr/lib/python3.8/site-packages/oauth2client/transport.py", line 173, in new_request
    resp, content = request(orig_request_method, uri, method, body,
  File "/usr/lib/python3.8/site-packages/oauth2client/transport.py", line 280, in request
    return http_callable(uri, method=method, body=body, headers=headers,
  File "/usr/lib/python3.8/site-packages/httplib2/__init__.py", line 1948, in request
    (response, content) = self._request(
  File "/usr/lib/python3.8/site-packages/httplib2/__init__.py", line 1621, in _request
    (response, content) = self._conn_request(
  File "/usr/lib/python3.8/site-packages/httplib2/__init__.py", line 1528, in _conn_request
    conn.connect()
  File "/usr/lib/python3.8/site-packages/httplib2/__init__.py", line 1309, in connect
    sock.connect((self.host, self.port))
  File "/usr/lib/python3.8/site-packages/socks.py", line 406, in connect
    self.__negotiatehttp(destpair[0],destpair[1])
  File "/usr/lib/python3.8/site-packages/socks.py", line 357, in __negotiatehttp
    while resp.find("\r\n\r\n")==-1:
TypeError: argument should be integer or bytes-like object, not 'str'

I saw a question like this on stackoverflow: https://stackoverflow.com/questions/60343758/socks-py-argument-should-be-integer-or-bytes-like-object-not-str

but I don’t understand what exactly to do. I would be glad to receive any links, and more detailed explanations

[edit by admin: formatting]

Sorry about that, it looks like a configuration error on our part. If you run this Bash command it should fix it:

pip3.8 install --user --force-reinstall PySocks

thanks, this solved the problem

Excellent, thanks for confirming!

https://github.com/davidedelpapa/gphotospy/issues/14#issuecomment-846391706 Still not fixed

@tnfrs Thanks for letting us know.