473,765 Members | 1,940 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

noob question: "TypeError" wrong number of args

Hi guys

Tried searching for a solution to this, but the error message is so
generic, that I could not get any meaningfull results.

Anyways - errormessage:
----------------------------------------------------
TypeError: addFile() takes exactly 1 argument (2 given)
----------------------------------------------------

The script is run with two args "arg1" and "arg2":
----------------------------------------------------
import sys

class KeyBase:
def addFile(file):
print "initialize the base with lines from this file"

print "These are the args"
print "Number of args %d" % len(sys.argv)
print sys.argv
print sys.version_inf o
print sys.version

f = sys.argv[1]
print "f = '%s'" % f
b = KeyBase()

b.addFile(f)
----------------------------------------------------

The output - including error message
(looks like stdout and stderr are a bit out of sync...):
----------------------------------------------------
These are the args
Traceback (most recent call last):

Number of args 3
['C:\\home\\<.. bla bla snip ...>\\bin\\test .py', 'arg1', 'arg2']
(2, 4, 2, 'final', 0)
2.4.2 (#67, Oct 30 2005, 16:11:18) [MSC v.1310 32 bit (Intel)]
f = 'arg1'

File "C:\Program Files\ActiveSta te Komodo
3.5\lib\support \dbgp\pythonlib \dbgp\client.py ", line 1806, in runMain
self.dbg.runfil e(debug_args[0], debug_args)
File "C:\Program Files\ActiveSta te Komodo
3.5\lib\support \dbgp\pythonlib \dbgp\client.py ", line 1529, in runfile
h_execfile(file , args, module=main, tracer=self)
File "C:\Program Files\ActiveSta te Komodo
3.5\lib\support \dbgp\pythonlib \dbgp\client.py ", line 590, in __init__
execfile(file, globals, locals)
File "C:\home\hbille \projects\bc4ro m\bin\test.py", line 20, in
__main__
b.addFile(f)
TypeError: addFile() takes exactly 1 argument (2 given)
----------------------------------------------------

I'm running this inside ActiveState Komodo on WinXP.

Hope one you wizards can give me pointers to either what I'm doing
wrong or maybe advise me what to modify in my setup.

Thank you!

Regards,
Holger

May 1 '06
42 3454
bruno at modulix wrote:
Edward Elliott wrote:
Ah, well then, there's no need for a full-blown parser. It should
suffice to recognize a class definition and modify the parameter list of
every def indented one level further than that.


won't do :

class CounterExample( object):
if compute_some_co nst_according_t o_phase_of_moon ():
def meth(...):
do_something(se lf, 42)


Uuuhhhhnn, you got me pardner. (cough, cough) my hands, they're so cold.
bruno? where'd you go, bruno? i can't see you anymore. are we back on
the farm? tell ma i love her. (clunk)

May 4 '06 #41
Edward Elliott wrote:
bruno at modulix wrote:
Edward Elliott wrote:
Ah, well then, there's no need for a full-blown parser. It should
suffice to recognize a class definition and modify the parameter list of
every def indented one level further than that.


won't do :

class CounterExample( object):
if compute_some_co nst_according_t o_phase_of_moon ():
def meth(...):
do_something(se lf, 42)

Uuuhhhhnn, you got me pardner. (cough, cough) my hands, they're so cold.
bruno? where'd you go, bruno? i can't see you anymore. are we back on
the farm? tell ma i love her. (clunk)


"We'll remember you foreeeeeever Eddy..."

--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'o****@xiludom. gro'.split('@')])"
May 5 '06 #42
And thank you gentlemen for turning my somewhat banale question into a
worthwhile discussion. :-)

I shall not forget self ever again!

May 8 '06 #43

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
7504
by: shearichard | last post by:
Hi - I have written some python to insert a row into a table using MySQLDB. I have never before written SQL/Python using embedded parameters in the SQL and I'm having some difficulties. Could someone point me in the right direction please ? The python looks like this : import MySQLdb import MySQLdb.cursors conn = MySQLdb.Connect(host='localhost', user='abc,passwd='def',
7
12718
by: Girish Sahani | last post by:
Hi, Please check out the following loop,here indexList1 and indexList2 are a list of numbers. for index1 in indexList1: for index2 in indexList2: if ti1 == ti2 and not index1 != indexList1.pop(): index1+=1 index2+=1 continue
0
9566
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
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9946
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
9832
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...
1
7371
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
6646
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
5413
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3921
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2800
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.