sqlalchemy.util.queue.Empty

1,263 views
Skip to first unread message

Sibylle Koczian

unread,
Nov 24, 2013, 6:50:30 AM11/24/13
to sqlal...@googlegroups.com
Hello,

I'm using SQLAlchemy 0.8.3, psycopg2 2.5.1, Python 3.3.3 on Windows 7,
PostgreSQL 9.3.1. No change to SQLAlchemy and psycopg2, update from
Python 3.3.2 to 3.3.3 some days ago.

Today I get this when trying to use this combination:


Python 3.3.3 (v3.3.3:c3896275c0f6, Nov 18 2013, 21:19:30) [MSC v.1600 64
bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import sqlalchemy as sa
>>> psystr = "postgresql+psycopg2://sib:mypassword@gespenst/sib"
>>> psy_engine = sa.create_engine(psystr, echo=True)
>>> psy_conn = psy_engine.connect()
Traceback (most recent call last):
File "C:\Python33\lib\site-packages\sqlalchemy\pool.py", line 768, in
_do_get
return self._pool.get(wait, self._timeout)
sqlalchemy.util.queue.Empty

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Python33\lib\site-packages\sqlalchemy\engine\strategies.py",
line 80, in connect
return dialect.connect(*cargs, **cparams)
File "C:\Python33\lib\site-packages\sqlalchemy\engine\default.py",
line 285, in connect
return self.dbapi.connect(*cargs, **cparams)
File "C:\Python33\lib\site-packages\psycopg2\__init__.py", line 164,
in connect
conn = _connect(dsn, connection_factory=connection_factory,
async=async)
psycopg2.OperationalError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "<pyshell#40>", line 1, in <module>
psy_conn = psy_engine.connect()
File "C:\Python33\lib\site-packages\sqlalchemy\engine\base.py", line
1641, in connect
return self._connection_cls(self, **kwargs)
File "C:\Python33\lib\site-packages\sqlalchemy\engine\base.py", line
59, in __init__
self.__connection = connection or engine.raw_connection()
File "C:\Python33\lib\site-packages\sqlalchemy\engine\base.py", line
1699, in raw_connection
return self.pool.unique_connection()
File "C:\Python33\lib\site-packages\sqlalchemy\pool.py", line 220, in
unique_connection
return _ConnectionFairy(self).checkout()
File "C:\Python33\lib\site-packages\sqlalchemy\pool.py", line 431, in
__init__
rec = self._connection_record = pool._do_get()
File "C:\Python33\lib\site-packages\sqlalchemy\pool.py", line 788, in
_do_get
con = self._create_connection()
File "C:\Python33\lib\site-packages\sqlalchemy\pool.py", line 225, in
_create_connection
return _ConnectionRecord(self)
File "C:\Python33\lib\site-packages\sqlalchemy\pool.py", line 318, in
__init__
self.connection = self.__connect()
File "C:\Python33\lib\site-packages\sqlalchemy\pool.py", line 379, in
__connect
connection = self.__pool._creator()
File "C:\Python33\lib\site-packages\sqlalchemy\engine\strategies.py",
line 87, in connect
) from e
sqlalchemy.exc.OperationalError: (OperationalError) None None
>>>

Using psycopg2 with Python 3.3.3, without SQLAlchemy in the mix, works
as expected.

Using pypostgresql instead of psycopg2 works as expected:

>>> import sqlalchemy
>>> pypgstr = "postgresql+pypostgresql://sib:mypassword@gespenst/sib"
>>> pypg_engine = sqlalchemy.create_engine(pypgstr, echo=True)
>>> pypg_conn = pypg_engine.connect()
2013-11-24 12:24:57,544 INFO sqlalchemy.engine.base.Engine select version()
2013-11-24 12:24:57,602 INFO sqlalchemy.engine.base.Engine {}
2013-11-24 12:24:57,610 INFO sqlalchemy.engine.base.Engine select
current_schema()
2013-11-24 12:24:57,619 INFO sqlalchemy.engine.base.Engine {}
>>>

The problem is definitely new, I got it trying to run scripts I've
certainly used without mishap a short time ago. I'm not sure what came
last: updating Python or using SQLAlchemy with psycopg2 the last time.
The last PostgreSQL update (from 9.2.x) came earlier. What can have
happened and what should I do?

Thank you for help,
Sibylle

Sibylle Koczian

unread,
Nov 24, 2013, 7:33:05 AM11/24/13
to sqlal...@googlegroups.com

Sibylle Koczian

unread,
Nov 24, 2013, 9:09:30 AM11/24/13
to sqlal...@googlegroups.com
Am 24.11.2013 13:33, schrieb Sibylle Koczian:
> Hello,
>
> I'm using SQLAlchemy 0.8.3, psycopg2 2.5.1, Python 3.3.3 on Windows 7,
> PostgreSQL 9.3.1. No change to SQLAlchemy and psycopg2, update from
> Python 3.3.2 to 3.3.3 some days ago.
>
...
Sorry for the double posting, problems with my mail program. Hopefully
solved now.

Sibylle

Michael Bayer

unread,
Nov 24, 2013, 5:39:07 PM11/24/13
to sqlal...@googlegroups.com

On Nov 24, 2013, at 7:33 AM, Sibylle Koczian <nulla.e...@web.de> wrote:

> Hello,
>
> I'm using SQLAlchemy 0.8.3, psycopg2 2.5.1, Python 3.3.3 on Windows 7, PostgreSQL 9.3.1. No change to SQLAlchemy and psycopg2, update from Python 3.3.2 to 3.3.3 some days ago.

the error is emitted by psycopg2 so I’d try a full reinstall of psycopg2 first. SQLAlchemy uses various psycopg2 extensions and switches that may be part of why a standalone test doesn’t produce a problem. Didn’t see anything on the psycopg2 tracker.
> --
> You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+...@googlegroups.com.
> To post to this group, send email to sqlal...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/groups/opt_out.

signature.asc

Michael Bayer

unread,
Nov 24, 2013, 6:31:09 PM11/24/13
to sqlal...@googlegroups.com
I just did a fresh build of Python 3.3.3 on OSX, upgrading from 3.3.2, didn’t re-install psycopg2, and I’m able to connect via SQLAlchemy. So the issue might be local to windows.
signature.asc

Sibylle Koczian

unread,
Nov 25, 2013, 10:13:32 AM11/25/13
to sqlal...@googlegroups.com
Am 24.11.2013 23:39, schrieb Michael Bayer:
>
> On Nov 24, 2013, at 7:33 AM, Sibylle Koczian<nulla.e...@web.de> wrote:
>
>> Hello,
>>
>> I'm using SQLAlchemy 0.8.3, psycopg2 2.5.1, Python 3.3.3 on Windows 7, PostgreSQL 9.3.1. No change to SQLAlchemy and psycopg2, update from Python 3.3.2 to 3.3.3 some days ago.
>
> the error is emitted by psycopg2 so I�d try a full reinstall of psycopg2 first. SQLAlchemy uses various psycopg2 extensions and switches that may be part of why a standalone test doesn�t produce a problem. Didn�t see anything on the psycopg2 tracker.
>
Done, but without effect. Reinstall of SQLAlchemy also without effect.
My Linux VM has older versions of everything (except PostgreSQL); no
problem there, but I don't think that tells us anything.

Will use py-postgresql for the time being.

Thank you,
Sibylle

Jonathan Vanasco

unread,
Nov 25, 2013, 11:14:25 AM11/25/13
to sqlal...@googlegroups.com
for what it's worth...

usually I see errors in psycopg and other c-extended python libraries when the python and/or postgres versions got upgraded.  it can get tricky when you're using a virtualenv, because you need to rebuild the entire virtualenv - and sometimes people forget that.  ( i know i have )

one of the best tricks I've found is this:

on Python upgrades, even from x.x.y to x.x.y+1 , rebuild a new virtualenv for all your projects and reinstall every module.

also, go into the system's site-packages library and do a hard "delete" of psycopg/other modules with c-extensions.  don't "upgrade", but instead install fresh.
Reply all
Reply to author
Forward
0 new messages