Hi,

>     buf += struct.pack(fmt, *args)
> 
> error: ubyte format requires 0 <= number <= 255

I think you don't need upgrade the python version.
Because above error appears when you input invalid arg to struct.pack.
Example is as follows.

$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 
>>> struct.pack('B3xII4xQQ',255,1,1,1,1)
'\xff\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00'
>>> struct.pack('B3xII4xQQ',256,1,1,1,1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
struct.error: ubyte format requires 0 <= number <= 255
>>> 

The fmt when serialize flow_stats_request message is 'B3xII4xQQ'.
And, an arg corresponding to 'B(unsigned char)' is TableID.
So, there is a possibility that the range of value of TableID is not in '0 <= 
value <= 255'.
However, TableID is supposed to be 255 by default in Traffic Monitor Chapter.

Hmm,,, according to the exception log, version of Ryu looks old.
Can you tell me version of your Ryu?
How to check version of Ryu is as follows.

$ ryu --version
ryu 3.30

thanks,

On 2016年02月18日 16:15, yu hsiang Huang wrote:
> Hi
> 
> 
> I'v tested the code in Traffic Monitor Chapter having error: ubyte format 
> requires 0 <= number <= 255. Looks like it is caused by fmt in pack_utils.py. 
> I have checked the internet that it should be fixed by upgrading the python 
> version. I am running SDN Hub Tutorial VM with python 2.7.6, it should be 
> fixed. What can I do with my code?
> 
> 
> 
> hub: uncaught exception: Traceback (most recent call last):
> 
>   File "/usr/local/lib/python2.7/dist-packages/ryu/lib/hub.py", line 52, in 
> _launch
> 
>     func(*args, **kwargs)
> 
>   File "/home/ubuntu/simple_minotor.py", line 32, in _monitor
> 
>     self._request_stats(dp)
> 
>   File "/home/ubuntu/simple_minotor.py", line 44, in _request_stats
> 
>     datapath.send_msg(req)
> 
>   File "/usr/local/lib/python2.7/dist-packages/ryu/controller/controller.py", 
> line 214, in send_msg
> 
>     msg.serialize()
> 
>   File 
> "/usr/local/lib/python2.7/dist-packages/ryu/ofproto/ofproto_parser.py", line 
> 205, in serialize
> 
>     self._serialize_body()
> 
>   File 
> "/usr/local/lib/python2.7/dist-packages/ryu/ofproto/ofproto_v1_3_parser.py", 
> line 3569, in _serialize_body
> 
>     self._serialize_stats_body()
> 
>   File 
> "/usr/local/lib/python2.7/dist-packages/ryu/ofproto/ofproto_v1_3_parser.py", 
> line 3787, in _serialize_stats_body
> 
>     self.out_group, self.cookie, self.cookie_mask)
> 
>   File "/usr/local/lib/python2.7/dist-packages/ryu/lib/pack_utils.py", line 
> 25, in msg_pack_into
> 
>     buf += struct.pack(fmt, *args)
> 
> error: ubyte format requires 0 <= number <= 255
> 
> 
> 
> */Best Regards,/*
> */
> /*
> **********************************
> *Yu Hsiang Huang*
> **********************************
> /GitHub:/ https://github.com/yu-hsiang
> /Linkedin: /https://tw.linkedin.com/in/yu-hsiang-huang-aaab4510a
> /Email:/ [email protected] <mailto:[email protected]>
> 
> 
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
> 
> 
> 
> _______________________________________________
> Ryu-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
> 

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to