472,994 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,994 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 1773
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Oktay Safak | last post by:
Hi, Is there an equivalent keyword argument syntax for these cases: d1 = {1:"one"} d2 = {"1":"one"} these don't work, of course:
6
by: Roy Smith | last post by:
I've got a function that takes a couple of optional keyword arguments. I want to check to make sure I didn't get passed an argument I didn't expect. Right now I'm doing: conversion = None drop...
14
by: Edward Diener | last post by:
In the tutorial on functions there are sections on default arguments and keyword arguments, yet I don't see the syntactic difference between them. For default arguments the tutorial shows: def...
20
by: talin at acm dot org | last post by:
Although I realize the perils of even suggesting polluting the Python namespace with a new keyword, I often think that it would be useful to consider defining an operator for testing whether or not...
69
by: markarichman | last post by:
Why is Firefox complaining with this error: ------------------------------------------------------------ missing ) after argument list setTimeout('breakOut',5000);...
7
by: Roman Susi | last post by:
Hi! it is interesting that I found this syntax error: File "<stdin>", line 1 str('sdfd', **a,) ^ SyntaxError: invalid syntax
33
by: Snis Pilbor | last post by:
With the "as if" rule in play, doesn't that effectively render the "register" keyword completely useless? Example: I make a silly compiler which creates code that goes out of its way to take a...
2
by: Wolfgang Meister | last post by:
From a CSharp program I would like to connect to an OracleDatabase with thefollowing code: using Oracle.DataAccess.Client; using Oracle.DataAccess.Types; .... string connectionstring = "User...
10
by: Armando Serrano Lombillo | last post by:
Why does Python give an error when I try to do this: Traceback (most recent call last): File "<pyshell#40>", line 1, in <module> len(object=) TypeError: len() takes no keyword arguments but...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.