473,976 Members | 2,542 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.bookma rks_find(person ='user', from=some_datet ime)

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.bookma rks_find(person ='user', from=some_datet ime)
^
<type 'exceptions.Syn taxError'>: invalid syntax

I have tried to prepare a dict and then passing it to the
method afterwards:
>>d = {'person': 'user', 'from': vorgestern}
magnolia.book marks_find(d)
<type 'exceptions.Typ eError'>: 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 1820
"Kai Kuehne" <ka********@gma il.comwrites:
>d = {'person': 'user', 'from': vorgestern}
magnolia.bookm arks_find(d)
<type 'exceptions.Typ eError'>: bookmarks_find( ) takes exactly 1
argument (2 given)

I'm out of ideas so help is greatly appreciated!
Try
magnolia.bookma rks_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.boo kmarks_find(d)
<type 'exceptions.Typ eError'>: bookmarks_find( ) takes exactly 1
argument (2 given)

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

magnolia.bookma rks_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.t his.cybersource .com.auwrote:
On Thu, 26 Jul 2007 03:33:20 +0200, Kai Kuehne wrote:
Try this:

magnolia.bookma rks_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.bo okmarks_find(d)
<type 'exceptions.Typ eError'>: bookmarks_find( ) takes exactly 1
argument (2 given)

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

Try this:

magnolia.bookma rks_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
5080
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
4628
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 = False for key, value in kwArgs.items(): if key == 'conversion': conversion = value elif key == 'drop':
14
5295
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 ask_ok(prompt, retries=4, complaint='Yes or no, please!'): while for keyword arguments the tutorial shows: def parrot(voltage, state='a stiff', action='voom', type='Norwegian Blue'):
20
7118
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 an item is a member of a category. Currently, we have the 'in' operator, which tests for membership within a container, and that works very well -- in particular, it allows such membership tests to be expressed in very natural way. So for...
69
16990
by: markarichman | last post by:
Why is Firefox complaining with this error: ------------------------------------------------------------ missing ) after argument list setTimeout('breakOut',5000); ------------------------------------------------------------ Here is the HTML that I'm producing:
7
1311
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
3355
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 full 10 minutes every time a "register" declared variable is read from or written to. Besides this lag, everything else runs as expected. Then my compiler is still C compliant, aye? If so, then it is unwise for any programmer to ever use the...
2
367
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 Id=peterm;Password=mypasswd;Data Source=XE;"; OracleConnection connection = new OracleConnection(connectionstring); connection.Open();
10
5165
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 not when I use a "normal" function: return len(object)
0
10353
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10171
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
11572
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10908
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
10084
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8460
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7604
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6415
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6558
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.