471,313 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,313 software developers and data experts.

Keyword argument 'from'; invalid syntax

Hi list!
I'm using pygmalion (magnolia api access lib) and want to
use the following method that it is offering:

magnolia.bookmarks_find(person='user', from=some_datetime)

As you may noticed, from is a keyword argument and so I
get the following error message from python:

File "<ipython console>", line 1
magnolia.bookmarks_find(person='user', from=some_datetime)
^
<type 'exceptions.SyntaxError'>: invalid syntax

I have tried to prepare a dict and then passing it to the
method afterwards:
>>d = {'person': 'user', 'from': vorgestern}
magnolia.bookmarks_find(d)
<type 'exceptions.TypeError'>: bookmarks_find() takes exactly 1
argument (2 given)

I'm out of ideas so help is greatly appreciated!
Thanks
Kai
Jul 26 '07 #1
4 1704
"Kai Kuehne" <ka********@gmail.comwrites:
>d = {'person': 'user', 'from': vorgestern}
magnolia.bookmarks_find(d)
<type 'exceptions.TypeError'>: bookmarks_find() takes exactly 1
argument (2 given)

I'm out of ideas so help is greatly appreciated!
Try
magnolia.bookmarks_find(**d)
Jul 26 '07 #2
On Thu, 26 Jul 2007 03:33:20 +0200, Kai Kuehne wrote:
I have tried to prepare a dict and then passing it to the
method afterwards:
>>>d = {'person': 'user', 'from': vorgestern}
magnolia.bookmarks_find(d)
<type 'exceptions.TypeError'>: bookmarks_find() takes exactly 1
argument (2 given)

I'm out of ideas so help is greatly appreciated!
Try this:

magnolia.bookmarks_find(**d)

although I suspect that will probably raise an exception as well. Judging
by the error message, it looks like bookmarks_find() takes only a single
argument, which I imagine would be the "self" instance automatically
provided at runtime.

--
Steven.

Jul 26 '07 #3
Hi Steven,

On 7/26/07, Steven D'Aprano <st***@remove.this.cybersource.com.auwrote:
On Thu, 26 Jul 2007 03:33:20 +0200, Kai Kuehne wrote:
Try this:

magnolia.bookmarks_find(**d)
This works perfectly, thank you guys.
Kai
Jul 26 '07 #4
On Thu, 26 Jul 2007 12:08:40 +1000, Steven D'Aprano wrote:
On Thu, 26 Jul 2007 03:33:20 +0200, Kai Kuehne wrote:
>I have tried to prepare a dict and then passing it to the method
afterwards:
>>>>d = {'person': 'user', 'from': vorgestern}
magnolia.bookmarks_find(d)
<type 'exceptions.TypeError'>: bookmarks_find() takes exactly 1
argument (2 given)

I'm out of ideas so help is greatly appreciated!

Try this:

magnolia.bookmarks_find(**d)

although I suspect that will probably raise an exception as well.
Judging by the error message, it looks like bookmarks_find() takes only
a single argument, which I imagine would be the "self" instance
automatically provided at runtime.
Could be bookmarks_find(person, **other), unpacking other manually.
Jul 26 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Oktay Safak | last post: by
6 posts views Thread by Roy Smith | last post: by
20 posts views Thread by talin at acm dot org | last post: by
69 posts views Thread by markarichman | last post: by
7 posts views Thread by Roman Susi | last post: by
33 posts views Thread by Snis Pilbor | last post: by
10 posts views Thread by Armando Serrano Lombillo | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.