473,397 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

TypeError: input_Func() takes exactly 1 positional argument (2 given)

Jory R Ferrell
Expand|Select|Wrap|Line Numbers
  1.  
  2. neuron = Neuron(neuron1, random.uniform(1, 10), 3)
  3.  
  4. my_Data = condition_Input(my_Data_1)
  5.  
  6. output = neuron.input_Func(my_Data)
  7.  
  8.  
I can't figure out why the sys keeps saying I have given
two positional arguments in the method call to input_Func...
I first start off with an list containing smaller lists.
I sum all elements using condition_Input (which works, giving me the value I expect everytime) and then that summed value is assigned to the my_Data and passed as a single argument to the method call.

What am I overlooking?
Jan 18 '12 #1

✓ answered by bvdet

Try a print statement print my_data to be sure. You probably left out the self argument in the method definition. Look at this interaction:
Expand|Select|Wrap|Line Numbers
  1. >>> class A:
  2. ...     def x(arg):
  3. ...         print arg
  4. ...         
  5. >>> z = A()
  6. >>> z.x("fff")
  7. Traceback (most recent call last):
  8.   File "<interactive input>", line 1, in <module>
  9. TypeError: x() takes exactly 1 argument (2 given)
  10. >>> class B:
  11. ...     def x(self, arg):
  12. ...         print arg
  13. ...         
  14. >>> y = B()
  15. >>> y.x("DDD")
  16. DDD
  17. >>> 

3 6560
bvdet
2,851 Expert Mod 2GB
Try a print statement print my_data to be sure. You probably left out the self argument in the method definition. Look at this interaction:
Expand|Select|Wrap|Line Numbers
  1. >>> class A:
  2. ...     def x(arg):
  3. ...         print arg
  4. ...         
  5. >>> z = A()
  6. >>> z.x("fff")
  7. Traceback (most recent call last):
  8.   File "<interactive input>", line 1, in <module>
  9. TypeError: x() takes exactly 1 argument (2 given)
  10. >>> class B:
  11. ...     def x(self, arg):
  12. ...         print arg
  13. ...         
  14. >>> y = B()
  15. >>> y.x("DDD")
  16. DDD
  17. >>> 
Jan 18 '12 #2
You called it! :P
I've spent the last hour trying to figure out why a method call that had worked before (failed to save previous version and rewrote it)
wasn't working now...
Drove me up the wall.
Thanks!
Jan 18 '12 #3
bvdet
2,851 Expert Mod 2GB
You're welcome. I've only made the same mistake a dozen or so times myself. :)
Jan 19 '12 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Learning Python | last post by:
I know this is dummy, just never saw an example of this. I want to use the special argument matching. A code like this: def adder(**varargs): sum=varargs] for next in varargs.keys():
4
by: cayblood | last post by:
Hello, I have the following class declaration in an include file: class Node { public: Node(string name = ""); Node(const Node& node); Node& operator=(const Node& node); bool...
2
by: Joris De Groote | last post by:
Hi I am busy trying to create a VB.NET program. I want to give the program an argument in the shortcut I created for that program (for example: program.exe argument). Now I just can't find how...
42
by: Holger | last post by:
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:...
4
by: Marco Wahl | last post by:
Hi, I want to give a tuple to a function where the function expects the respective tuple-size number of arguments. The following session illustrates what I want to do and the respective...
4
by: Kai Kuehne | last post by:
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,...
2
by: Mike | last post by:
In the following Display inherits from the Tkinter class Canvas: import sys from Tkinter import * class Display(Canvas) : .... def fill_canvas() : slop=self.slop...
1
by: mk | last post by:
It seems like getter is defined in such way that it passes only 'self': class FunDict(dict): def __init__(self): self.fundict = dict() def fget(self, fun): return fundict
0
by: James Mills | last post by:
On Fri, Oct 31, 2008 at 8:49 AM, mark floyd <emfloyd2@gmail.comwrote: Mark, this is correct behavior. You have 3 positional arguments in the function definition. You _must_ aupply _all_ 3 of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...

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.