The exception here is fixed in master, rel_1_0 and rel_0_9 branches, it is 
https://bitbucket.org/zzzeek/sqlalchemy/issue/3063/engine-base-safe_close_cursor-assumes-our.
   That is, it won't choke trying to log the cursor close error.    But there's 
still an error that was raised here when this occurred, if it happens on the 
new code, you'll get the error that really happened.


On May 30, 2014, at 12:36 PM, Michael Bayer <mike...@zzzcomputing.com> wrote:

> 
> is that happening every time?  it's a bug where an exception is raised on 
> connect but it's not being allowed to display.   Can you please invoke the 
> statement "show standard_conforming_strings" on your connection and/or 
> Postgresql database so I can see what it's saying?
> 
> 
> 
> 
> 
> On May 30, 2014, at 12:04 PM, Pau Tallada <tall...@pic.es> wrote:
> 
>> Hi,
>> 
>> I don't know if I am doing something wrong :/
>> It also happens if instead of engine.connect().connection I use 
>> engine.raw_connection.
>> 
>> But I think that the error dissappears if you use a "standard" connection of 
>> something like that.
>> There has to be some side effect, because when I run this on the debugger, i 
>> does not always fail :/
>> 
>>     engine.connect().connection.cursor().copy_expert("COPY ({0}) TO STDOUT 
>> DELIMITER ' ' CSV".format(config['query']), open(full_catalog_filename_nfs, 
>> 'w'), size=65536)
>>   File 
>> "/nfs/pau/PAUdm/codes/jcarrete/envs_jcarrete/photoz_env/lib/python2.6/site-packages/SQLAlchemy-0.9.4-py2.6-linux-x86_64.egg/sqlalchemy/engine/base.py",
>>  line 1709, in connect
>>     return self._connection_cls(self, **kwargs)
>>   File 
>> "/nfs/pau/PAUdm/codes/jcarrete/envs_jcarrete/photoz_env/lib/python2.6/site-packages/SQLAlchemy-0.9.4-py2.6-linux-x86_64.egg/sqlalchemy/engine/base.py",
>>  line 59, in __init__
>>     self.__connection = connection or engine.raw_connection()
>>   File 
>> "/nfs/pau/PAUdm/codes/jcarrete/envs_jcarrete/photoz_env/lib/python2.6/site-packages/SQLAlchemy-0.9.4-py2.6-linux-x86_64.egg/sqlalchemy/engine/base.py",
>>  line 1778, in raw_connection
>>     return self.pool.unique_connection()
>>   File 
>> "/nfs/pau/PAUdm/codes/jcarrete/envs_jcarrete/photoz_env/lib/python2.6/site-packages/SQLAlchemy-0.9.4-py2.6-linux-x86_64.egg/sqlalchemy/pool.py",
>>  line 273, in unique_connection
>>     return _ConnectionFairy._checkout(self)
>>   File 
>> "/nfs/pau/PAUdm/codes/jcarrete/envs_jcarrete/photoz_env/lib/python2.6/site-packages/SQLAlchemy-0.9.4-py2.6-linux-x86_64.egg/sqlalchemy/pool.py",
>>  line 626, in _checkout
>>     fairy = _ConnectionRecord.checkout(pool)
>>   File 
>> "/nfs/pau/PAUdm/codes/jcarrete/envs_jcarrete/photoz_env/lib/python2.6/site-packages/SQLAlchemy-0.9.4-py2.6-linux-x86_64.egg/sqlalchemy/pool.py",
>>  line 433, in checkout
>>     rec = pool._do_get()
>>   File 
>> "/nfs/pau/PAUdm/codes/jcarrete/envs_jcarrete/photoz_env/lib/python2.6/site-packages/SQLAlchemy-0.9.4-py2.6-linux-x86_64.egg/sqlalchemy/pool.py",
>>  line 945, in _do_get
>>     return self._create_connection()
>>   File 
>> "/nfs/pau/PAUdm/codes/jcarrete/envs_jcarrete/photoz_env/lib/python2.6/site-packages/SQLAlchemy-0.9.4-py2.6-linux-x86_64.egg/sqlalchemy/pool.py",
>>  line 278, in _create_connection
>>     return _ConnectionRecord(self)
>>   File 
>> "/nfs/pau/PAUdm/codes/jcarrete/envs_jcarrete/photoz_env/lib/python2.6/site-packages/SQLAlchemy-0.9.4-py2.6-linux-x86_64.egg/sqlalchemy/pool.py",
>>  line 409, in __init__
>>     exec_once(self.connection, self)
>>   File 
>> "/nfs/pau/PAUdm/codes/jcarrete/envs_jcarrete/photoz_env/lib/python2.6/site-packages/SQLAlchemy-0.9.4-py2.6-linux-x86_64.egg/sqlalchemy/event/attr.py",
>>  line 247, in exec_once
>>     self(*args, **kw)
>>   File 
>> "/nfs/pau/PAUdm/codes/jcarrete/envs_jcarrete/photoz_env/lib/python2.6/site-packages/SQLAlchemy-0.9.4-py2.6-linux-x86_64.egg/sqlalchemy/event/attr.py",
>>  line 257, in __call__
>>     fn(*args, **kw)
>>   File 
>> "/nfs/pau/PAUdm/codes/jcarrete/envs_jcarrete/photoz_env/lib/python2.6/site-packages/SQLAlchemy-0.9.4-py2.6-linux-x86_64.egg/sqlalchemy/util/langhelpers.py",
>>  line 1203, in go
>>     return once_fn(*arg, **kw)
>>   File 
>> "/nfs/pau/PAUdm/codes/jcarrete/envs_jcarrete/photoz_env/lib/python2.6/site-packages/SQLAlchemy-0.9.4-py2.6-linux-x86_64.egg/sqlalchemy/engine/strategies.py",
>>  line 165, in first_connect
>>     dialect.initialize(c)
>>   File 
>> "/nfs/pau/PAUdm/codes/jcarrete/envs_jcarrete/photoz_env/lib/python2.6/site-packages/SQLAlchemy-0.9.4-py2.6-linux-x86_64.egg/sqlalchemy/dialects/postgresql/psycopg2.py",
>>  line 390, in initialize
>>     super(PGDialect_psycopg2, self).initialize(connection)
>>   File 
>> "/nfs/pau/PAUdm/codes/jcarrete/envs_jcarrete/photoz_env/lib/python2.6/site-packages/SQLAlchemy-0.9.4-py2.6-linux-x86_64.egg/sqlalchemy/dialects/postgresql/base.py",
>>  line 1576, in initialize
>>     "show standard_conforming_strings"
>>   File 
>> "/nfs/pau/PAUdm/codes/jcarrete/envs_jcarrete/photoz_env/lib/python2.6/site-packages/SQLAlchemy-0.9.4-py2.6-linux-x86_64.egg/sqlalchemy/engine/base.py",
>>  line 650, in scalar
>>     return self.execute(object, *multiparams, **params).scalar()
>>   File 
>> "/nfs/pau/PAUdm/codes/jcarrete/envs_jcarrete/photoz_env/lib/python2.6/site-packages/SQLAlchemy-0.9.4-py2.6-linux-x86_64.egg/sqlalchemy/engine/base.py",
>>  line 712, in execute
>>     return self._execute_text(object, multiparams, params)
>>   File 
>> "/nfs/pau/PAUdm/codes/jcarrete/envs_jcarrete/photoz_env/lib/python2.6/site-packages/SQLAlchemy-0.9.4-py2.6-linux-x86_64.egg/sqlalchemy/engine/base.py",
>>  line 861, in _execute_text
>>     statement, parameters
>>   File 
>> "/nfs/pau/PAUdm/codes/jcarrete/envs_jcarrete/photoz_env/lib/python2.6/site-packages/SQLAlchemy-0.9.4-py2.6-linux-x86_64.egg/sqlalchemy/engine/base.py",
>>  line 947, in _execute_context
>>     context)
>>   File 
>> "/nfs/pau/PAUdm/codes/jcarrete/envs_jcarrete/photoz_env/lib/python2.6/site-packages/SQLAlchemy-0.9.4-py2.6-linux-x86_64.egg/sqlalchemy/engine/base.py",
>>  line 1097, in _handle_dbapi_exception
>>     self._safe_close_cursor(cursor)
>>   File 
>> "/nfs/pau/PAUdm/codes/jcarrete/envs_jcarrete/photoz_env/lib/python2.6/site-packages/SQLAlchemy-0.9.4-py2.6-linux-x86_64.egg/sqlalchemy/engine/base.py",
>>  line 1050, in _safe_close_cursor
>>     self.connection._logger.error(
>> AttributeError: 'psycopg2._psycopg.connection' object has no attribute 
>> '_logger'
>> 
>> 
>> -- 
>> ----------------------------------
>> Pau Tallada Crespí
>> Dep. d'Astrofísica i Cosmologia
>> Port d'Informació Científica (PIC)
>> Tel: +34 93 586 8233
>> ----------------------------------
>> 
>> 
>> -- 
>> 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+unsubscr...@googlegroups.com.
>> To post to this group, send email to sqlalchemy@googlegroups.com.
>> Visit this group at http://groups.google.com/group/sqlalchemy.
>> For more options, visit https://groups.google.com/d/optout.
> 
> 
> -- 
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to