Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > how to prevent the "extended call syntax" (*) from expanding a stringinto a list of characters

Reply
Thread Tools

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

 
 
fulv
Guest
Posts: n/a
 
      07-22-2010
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
 
Reply With Quote
 
 
 
 
James Mills
Guest
Posts: n/a
 
      07-22-2010
On Thu, Jul 22, 2010 at 4:26 PM, fulv <(E-Mail Removed)> wrote:
> *args = (connection_string)


Replace this with:

args = (connection_string,)

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

cheers
James

--
-- James Mills
--
-- "Problems are solved by method"
 
Reply With Quote
 
 
 
 
Dennis Lee Bieber
Guest
Posts: n/a
 
      07-22-2010
On Wed, 21 Jul 2010 23:26:35 -0700 (PDT), fulv <(E-Mail Removed)>
declaimed the following in gmane.comp.python.general:

> 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...
--
Wulfraed Dennis Lee Bieber AF6VN
http://www.velocityreviews.com/forums/(E-Mail Removed) HTTP://wlfraed.home.netcom.com/

 
Reply With Quote
 
fulv
Guest
Posts: n/a
 
      07-22-2010

Thank you all! Really appreciate the quick help!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Expanding Programs List Marc Computer Support 2 01-18-2006 09:56 PM
HOWTO: Prevent ASP page from displaying Chinese characters when outputing using... Antonio Ooi ASP General 2 05-15-2004 10:54 PM
Prevent Expand and Collapse Characters in Output Bill XML 1 04-28-2004 08:49 AM
Expanding a perl regex to a list of files with full paths Neil Shadrach Perl Misc 2 10-28-2003 03:14 PM



Advertisments