how to prevent the "extended call syntax" (*) from expanding a stringinto a list of characters

F

fulv

I get the following error:

File "<stdin>", line 1, in ?
File "/Users/fulvio/plone/seiu_new/buildout/eggs/z3c.saconfig-0.11-
py2.4.egg/z3c/saconfig/utility.py", line 164, in __call__
_ENGINES[self._key] = engine = sqlalchemy.create_engine(
File "/Users/fulvio/plone/seiu_new/buildout/eggs/SQLAlchemy-0.6.3-
py2.4.egg/sqlalchemy/engine/__init__.py", line 244, in create_engine
return strategy.create(*args, **kwargs)
TypeError: create() takes exactly 2 non-keyword arguments (150 given)

Basically, args and kwargs come as the return values from my
overridden function configuration():

args, kw = self.configuration()
_ENGINES[self._key] = engine =
sqlalchemy.create_engine(
*args, **kw)


This is what I'm returning from configuration():

args = (connection_string)
kwargs = {'echo' : True, 'encoding' : 'cp1252'}
return args, kwargs

In other words, args is a list containing just one string. It seems
to me that create_engine is interpreting that as a list of 150
characters.

Any suggestions, on what I'm doing wrong?

Thanks!
Fulvio
 
J

James Mills

 args = (connection_string)

Replace this with:

args = (connection_string,)

NOTE: The trailing , (comma) indicating that this _is_ a tuple.

cheers
James
 
D

Dennis Lee Bieber

args = (connection_string)

args = (connection_string,)
kwargs = {'echo' : True, 'encoding' : 'cp1252'}
return args, kwargs

In other words, args is a list containing just one string. It seems
to me that create_engine is interpreting that as a list of 150
characters.

Any suggestions, on what I'm doing wrong?
Parens don't make a tuple, the comma does...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top