K
K
Kastuś2018-07-04 00:05:21
Python
Kastuś, 2018-07-04 00:05:21

py-postgres postgresql10 error?

I'm new to python It's
worth ubuntu 18.04 postgresql 10 I'm
writing an API to connect to the database
, it swears like this:

spoiler
File "/home/mypc/PycharmProjects/API/main.py", line 222, in get_item
with db_conn() as db:
File "/home/mypc/PycharmProjects/API/main.py", line 35, in db_conn
return postgresql.open('pq://postgres:[email protected]:5432/base')
File "/home/mypc/.local/lib/python3.6/site-packages/postgresql/__init__.py", line 94, in open
c.connect()
File "/home/mypc/.local/lib/python3.6/site-packages/postgresql/driver/pq3.py", line 2427, in connect
self._establish()
File "/home/mypc/.local/lib/python3.6/site-packages/postgresql/driver/pq3.py", line 2559, in _establish
self.version_info = pg_version.normalize(pg_version.split(sv))
File "/home/mypc/.local/lib/python3.6/site-packages/postgresql/versionstring.py", line 28, in split
vlist = [int(x or '0') for x in v[:-1]]
File "/home/mypc/.local/lib/python3.6/site-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: '4 (Ubuntu 10'

and it worked on Ubuntu 16.04 postgresql 9.5
Where to dig?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
M
Melkij, 2018-07-04
@Gytim

Error in the library being used. So you can't query the database version.
It breaks exactly at 10, obviously due to a change in the numbering policy, up to 10 it was xyz, where xy is the major version, starting from ten releases are numbered xy, where the major version is only the first digit. Stupid code trying to parse the number finds something other than what it expects.
Probably, a year and a half after the release of postgresql 10.0, the library has already been fixed. I would like to hope that the use of the current_setting('server_version_num') specially designed for this purpose, and not again a crutch around the version() that is not intended for that
Dig accordingly in the direction of updating the version of the library. If not, roll back to postgresql 9.6.

P
Power, 2014-10-30
@Power

"The file system is read-only" is no accident. Most likely, the operating system detected errors on the FS and switched it to read-only mode. And there are no access rights. Maybe you didn't unmount the flash drive/hard drive last time before pulling it out. Or the device itself is junk. Details can be seen in /var/log/syslog
Accordingly, the solution is to always unmount correctly.

J
Jeremiah McKing, 2014-11-04
@mcking230

There was a similar problem. The fact is that Ubuntu is not very friendly with ntfs, if your flash drives are with such a fs, then even for fun, try FAT32

R
RocknCat, 2016-05-29
@RocknCat

You copy all the data to the logic for example / dev / sda3, take the flash in your hands, run giparted, re-create the table, and voila, no problem, Carl

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question