-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3.1.1: TypeError: cannot use a string pattern on a bytes-like object #348
Comments
That's strange, I cannot reproduce (tried to install miniconda, which is Python 3.8.16 at the moment). Can you try to run this python session from >>> from pgactivity import pg
>>> pg.__version__
>>> conn = pg.connect()
>>> pg.fetchone(conn, "select version()") |
Well, I get
if I do that, but that's because my server is not local. I have to use a connection string, like this:
When I start pg_activity, I specify the command line arguments |
Ok; then can you try? >>> import psycopg
>>> conn = psycopg.connect("<your connection string>")
>>> conn.execute("select version()").fetchone() |
|
Using
|
Indeed; but all these calls should return |
There's something strange with your Python environment or your locale setup. |
Any idea what? I've tried with |
Well, it seems to be a bug in psycopg: Looks like it was fixed on February 1 (psycopg/psycopg#504), but a new version hasn't been released since then. I'm using the latest released version, 3.1.8, from January 28th. |
Indeed; the client encoding is probably a good lead. Can you try adding On my side: >>> import psycopg
>>> conn = psycopg.connect("client_encoding=sql_ascii")
>>> conn.info.encoding
'ascii'
>>> conn.execute("select version()").fetchone()
(b'PostgreSQL 15.2 (Debian 15.2-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit',)
>>>
>>> conn = psycopg.connect()
>>> conn.info.encoding
'utf-8'
>>> conn.execute("select version()").fetchone()
('PostgreSQL 15.2 (Debian 15.2-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit',) However, the fix in psycopg you mention would not resolve this particular issue as it does not apply to all executed statements but only to |
Yes, appending
|
If I do that with pg_activity, I still get an error, unfortunately:
|
Yes, I noticed that on my side too yesterday; that's a broader issue. I'm working on a fix. Thank you for your patience. |
@esabol I've stack all pending changes in a branch |
@dlax : It works! Thank you very much! Unrelated (apologies): Not sure if this is an issue with my terminal or what, but there are blue
What are those supposed to be? Is that how it's supposed to look? Also, every ~5 seconds or so, a lot of text is printed to the screen, but then it vanishes so quickly that I can't read what it says. Is that to be expected? |
Thank you for confirming, I merged the changes and will release a new version later today. About rendering issues, no it's not how it's supposed to look like, see the screenshot on project homepage. These are blue What terminal are you using? |
$TERM is "screen". But if I detach from my screen, my $TERM is "xterm-color", and I still get the blue I think the text that flashes and then disappears every ~5 seconds are warnings about the |
Hi. The
README.md
says Python 3.7 and above is supported? I'm using Python 3.8.5, but I'm getting the following error:I installed it using the command
python3 -m pip install "pg_activity[psycopg]" --user
.Thanks,
Ed
The text was updated successfully, but these errors were encountered: