[pox-dev] typeerror-init-takes-exactly-3-arguments-2-given

Murphy McCauley murphy.mccauley at gmail.com
Tue Apr 29 12:41:11 PDT 2014


I don't understand how this tool gives such unhelpful error messages.  It's not supposed to be a guessing game; it should point straight at where the problem is.  Running this code with POX using the --verbose option gives this:

[pox]$ ./pox.py --verbose tst
POX 0.3.0 (dart) / Copyright 2011-2014 James McCauley, et al.
Error executing tst.launch:
Traceback (most recent call last):
  File "/Users/murphy/tmp/pox/pox/boot.py", line 243, in _do_launch
    if f(**params) is False:
  File "/Users/murphy/tmp/pox/ext/tst.py", line 27, in launch
    MyCache = VideoCache('IDEALCACHE')
TypeError: __init__() takes exactly 3 arguments (2 given)

Parameters for tst:
 None.

.. which clearly indicates the problem is with calling the __init__() for VideoCache on line 27.

(Which is a problem because while your VideoCache class takes a connection and a transparent argument -- apparently copied from l2_learning -- you're passing in a single string.)

-- Murphy

On Apr 29, 2014, at 12:01 PM, kofi adu <kofiadubb at yahoo.com> wrote:

> Hi Murphy
> 
> i am trying to run my program and it gives me this prompt. Is there any help? thanks
> 
> i get this error  
> typeerror-init-takes-exactly-3-arguments-2-given
> 
> 
> 
> # class 
> class VideoCache (object):
> 
>   
> 
>   		# Constructor of the class 
>  def __init__(self, connection, transparent):
>      # track the connection to the switch to send messages
>     						self.connection = connection
>     self.transparent = transparent
> 
>     # Add listener events to handle connection events from OpenFlow switch 
>     connection.addListeners(self)
>     log.debug("Initializing VideoCache, transparent=%s", str(self.transparent))
> 
>     # Turn on Nicira packet_ins. 
>     # Nicira extensions to support openFlow 1.0
>     msg = nx.nx_packet_in_format()
>     event.connection.send(msg)
> 
>     # Turn on ability to specify table in flow_mods
>     msg = nx.nx_flow_mod_table_id()
>     event.connection.send(msg)  
> 
> 
> 
> the launch function below
> 
> def launch ():
> 
>   # create new class object 
>   MyCache = VideoCache('IDEALCACHE')
> 
>   # add this class into the core.
>   core.register("cache", MyCache) 
>   
>  
>   log.info("Video cache is running.")
>   
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.noxrepo.org/pipermail/pox-dev-noxrepo.org/attachments/20140429/66374b71/attachment-0002.htm>


More information about the pox-dev mailing list