Discussion:
[Ryu-devel] Problem with loading data saved in .npz file while running Simple_switch_13.py
Gandhimathi Velusamy
2016-05-07 23:52:47 UTC
Permalink
Hi,

I have added some functionality in packet-in, when a packet in happens
it will be sent to classify function which reads some data from a .npz file
and does some work and classifies tehe packet.

When I run the classifier.py separately which has classify function it
works for me. But when I run simple_switch_13.py I am getting the following
error.

SimpleSwitch13: Exception occurred during handler processing. Backtrace
from offending handler [_packet_in_handler] servicing event
[EventOFPPacketIn] follows.

Traceback (most recent call last):

File "/usr/local/lib/python2.7/dist-packages/ryu/base/app_manager.py",
line 290, in _event_loop

handler(ev)

File "/users/gvelus01/ryu/ryu/app/simple_switch_13.py", line 136, in
_packet_in_handler

classify(decidata, in_port) # classify and push flow through rest api

File "/users/gvelus01/ryu/ryu/app/simple_switch_13.py", line 181, in
classify

npzfile = np.load('trainingresult.npz')

File "/usr/lib/python2.7/dist-packages/numpy/lib/npyio.py", line 370, in
load

fid = open(file, "rb")

IOError: [Errno 2] No such file or directory: 'trainingresult.npz'


The program which writes data into 'trainingresult.npz' , the classifier.py
which reads the data and simple switch are all in the same directory under
ryu/ryu/app.


When I started Python interpreter under /ryu/ryu/app directory, and tested
by loading the .npz file. I am able to read it.

May I please, know how to get rid of the error while running
simple_switch_13.py?

FYI, I am running Ryu controller as below:


@controller:~/ryu$ PYTHONPATH=. ./bin/ryu-manager
ryu/app/simple_switch_13.py


Do I need to set any path?


Even I copy pasted the classifier code inside simple_switch_13.py and
getting the same error.

Thanks

Gandhimathi
Gandhimathi Velusamy
2016-05-08 07:24:42 UTC
Permalink
Hi

I included the path while loading .npz for reading as below and now it is
working.

npzfile = np.load('/users/gvelu/ryu/ryu/app/trainingresult.npz')


Thanks

Gandhimathi
Post by Gandhimathi Velusamy
Hi,
I have added some functionality in packet-in, when a packet in
happens it will be sent to classify function which reads some data from a
.npz file and does some work and classifies tehe packet.
When I run the classifier.py separately which has classify function it
works for me. But when I run simple_switch_13.py I am getting the following
error.
SimpleSwitch13: Exception occurred during handler processing. Backtrace
from offending handler [_packet_in_handler] servicing event
[EventOFPPacketIn] follows.
File "/usr/local/lib/python2.7/dist-packages/ryu/base/app_manager.py",
line 290, in _event_loop
handler(ev)
File "/users/gvelus01/ryu/ryu/app/simple_switch_13.py", line 136, in
_packet_in_handler
classify(decidata, in_port) # classify and push flow through rest api
File "/users/gvelus01/ryu/ryu/app/simple_switch_13.py", line 181, in
classify
npzfile = np.load('trainingresult.npz')
File "/usr/lib/python2.7/dist-packages/numpy/lib/npyio.py", line 370, in
load
fid = open(file, "rb")
IOError: [Errno 2] No such file or directory: 'trainingresult.npz'
The program which writes data into 'trainingresult.npz' , the
classifier.py which reads the data and simple switch are all in the same
directory under ryu/ryu/app.
When I started Python interpreter under /ryu/ryu/app directory, and
tested by loading the .npz file. I am able to read it.
May I please, know how to get rid of the error while running
simple_switch_13.py?
@controller:~/ryu$ PYTHONPATH=. ./bin/ryu-manager
ryu/app/simple_switch_13.py
Do I need to set any path?
Even I copy pasted the classifier code inside simple_switch_13.py and
getting the same error.
Thanks
Gandhimathi
Loading...