Skip to content

ValueError: invalid literal for int() with base 10: '3 (Ubuntu 10' when connecting #95

@ThomasChr

Description

@ThomasChr

Here the full stack trace:

Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.6/dist-packages/postgresql/init.py", line 94, in open
c.connect()
File "/usr/local/lib/python3.6/dist-packages/postgresql/driver/pq3.py", line 2427, in connect
self._establish()
File "/usr/local/lib/python3.6/dist-packages/postgresql/driver/pq3.py", line 2559, in _establish
self.version_info = pg_version.normalize(pg_version.split(sv))
File "/usr/local/lib/python3.6/dist-packages/postgresql/versionstring.py", line 28, in split
vlist = [int(x or '0') for x in v[:-1]]
File "/usr/local/lib/python3.6/dist-packages/postgresql/versionstring.py", line 28, in
vlist = [int(x or '0') for x in v[:-1]]
ValueError: invalid literal for int() with base 10: '3 (Ubuntu 10'

This issue has already been reported here: #93

The problem is that on Postgres 10 Ubuntu adds the Ubuntu Version to the Postgres Version string which py-postgresql can't handle.
My version string looks like this:
10.3 (Ubuntu 10.3-1)

I have a fix ready and will attach it here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions