add-apt-repository httplib2.socks.HTTPError: (403, b'Forbidden')

Aaron Rainbolt arraybolt3 at ubuntu.com
Mon Jan 23 19:21:45 UTC 2023


On 1/23/23 09:41, Emanuel Gonzalez wrote:
> I’m deploying some legacy projects that need Python 3.7 in Ubuntu 22.04.
>
>
> When I try to add the repository I get the following error:
>
> sudo add-apt-repository ppa:deadsnakes/ppa -y
> Traceback (most recent call last):
>   File "/usr/bin/add-apt-repository", line 364, in <module>
>     sys.exit(0 if addaptrepo.main() else 1)
>   File "/usr/bin/add-apt-repository", line 347, in main
>     shortcut = handler(source, **shortcut_params)
>   File 
> "/usr/lib/python3/dist-packages/softwareproperties/shortcuts.py", line 
> 40, in shortcut_handler
>     return handler(shortcut, **kwargs)
>   File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", 
> line 82, in __init__
>     if self.lpppa.publish_debug_symbols:
>   File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", 
> line 120, in lpppa
>     self._lpppa = self.lpteam.getPPAByName(name=self.ppaname)
>   File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", 
> line 107, in lpteam
>     self._lpteam = self.lp.people(self.teamname)
>   File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", 
> line 98, in lp
>     self._lp = login_func("%s.%s" % (self.__module__, 
> self.__class__.__name__),
>   File "/usr/lib/python3/dist-packages/launchpadlib/launchpad.py", 
> line 494, in login_anonymously
>     return cls(
>   File "/usr/lib/python3/dist-packages/launchpadlib/launchpad.py", 
> line 230, in __init__
>     super(Launchpad, self).__init__(
>   File 
> "/usr/lib/python3/dist-packages/lazr/restfulclient/resource.py", line 
> 472, in __init__
>     self._wadl = self._browser.get_wadl_application(self._root_uri)
>   File 
> "/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py", line 
> 447, in get_wadl_application
>     response, content = self._request(url, media_type=wadl_type)
>   File 
> "/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py", line 
> 389, in _request
>     response, content = self._request_and_retry(
>   File 
> "/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py", line 
> 359, in _request_and_retry
>     response, content = self._connection.request(
>   File "/usr/lib/python3/dist-packages/httplib2/__init__.py", line 
> 1725, in request
>     (response, content) = self._request(
>   File "/usr/lib/python3/dist-packages/launchpadlib/launchpad.py", 
> line 144, in _request
>     response, content = super(LaunchpadOAuthAwareHttp, self)._request(
>   File 
> "/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py", line 
> 184, in _request
>     return super(RestfulHttp, self)._request(
>   File "/usr/lib/python3/dist-packages/httplib2/__init__.py", line 
> 1441, in _request
>     (response, content) = self._conn_request(conn, request_uri, 
> method, body, headers)
>   File "/usr/lib/python3/dist-packages/httplib2/__init__.py", line 
> 1363, in _conn_request
>     conn.connect()
>   File "/usr/lib/python3/dist-packages/httplib2/__init__.py", line 
> 1153, in connect
>     sock.connect((self.host, self.port))
>   File "/usr/lib/python3/dist-packages/httplib2/socks.py", line 504, 
> in connect
> self.__negotiatehttp(destpair[0], destpair[1])
>   File "/usr/lib/python3/dist-packages/httplib2/socks.py", line 465, 
> in __negotiatehttp
>     raise HTTPError((statuscode, statusline[2]))
> httplib2.socks.HTTPError: (403, b'Forbidden')

A 403 Forbidden error sounds like something's wrong on the server side 
or your add-apt-repository command is wrong. Could you share the exact 
command you're using to try to add the repository?

>
> I tried to update the library but the problem persists. python3 -m pip 
> install --upgrade httplib2
>
> Any helps?
Personally, I just use pyenv for when I need older Python versions for 
software that needs or benefits from them. 
https://github.com/pyenv/pyenv Works quite well in my experience - I 
just set a specific Python version for each directory containing the 
software that needs it. So far I have three versions of Python installed 
(the default one that comes with Ubuntu, and two older versions 
installed through pyenv) and everything just works.
>
>
>
-- 
Aaron Rainbolt
Lubuntu Developer
https://github.com/ArrayBolt3
https://launchpad.net/~arraybolt3
@arraybolt3:lubuntu.me on Matrix, arraybolt3 on irc.libera.chat

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20230123/f3a7137b/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0x6169B9B4248C0464.asc
Type: application/pgp-keys
Size: 4853 bytes
Desc: OpenPGP public key
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20230123/f3a7137b/attachment-0001.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20230123/f3a7137b/attachment-0001.sig>


More information about the ubuntu-users mailing list