Thanks Iwase. This really helps.
I tried to create the file *application1.py *and *mybgpapp1.py* in the
distribution site
*/usr/local/lib/python2.7/dist-packages/ryu/services/protocols/bgp* and i
am able to run my application from there.
Is this normal?. This is a little tedious. I think i will re-install ryu's
codes.

Thanks
Hadem




On Tue, Feb 27, 2018 at 11:56 AM, Iwase Yusuke <iwase.yusu...@gmail.com>
wrote:

> Hi Hadem,
>
> It looks like a problem of Python import mechanism (not or Ryu).
>
> > from ryu.services.protocols.bgp import application as bgp_application
>
> With the above statement, Python will try to import "application" from
> "ryu"
> package which located on directories in PYTHONPATH, "sys.path" or so.
> When you specified "application", Python could find it from the installed
> "ryu"
> package, but when "application1", you have not yet installed
> "application1.py"
> after your modification, right? So Python failed to find it from "ryu"
> package.
>
> Then, please re-install Ryu with "modified" source codes like;
>  # At top of ryu directory
>  $ python setup.py install
> Re-installation is required every time you modified Ryu's codes.
>
> FYI, "ryu.services.protocols.bgp.application" can be integrated with your
> application (not placed under "ryu" directory") without "directly"
> modifying
> Ryu's codes. Please refer to the following.
> http://ryu.readthedocs.io/en/latest/app/bgp_application.html
> #integration-with-other-applications
>
> Thanks,
> Iwase
>
>
> On 2018年02月27日 14:49, Pynbiang Hadem wrote:
>
>> Hi,
>>
>> I have a ryu module/file(*mybgpapp1.py*) in the path
>> */home/mininet/ryu/ryu/services/protocols/bgp*
>> 1) When i am importing from file *application.py* as below it works fine:
>>
>> from ryu.services.protocols.bgpimport applicationas bgp_application
>>
>> 2)However when i import from another file application1.py (a modified
>> version of application.py)
>>
>> from ryu.services.protocols.bgpimport application1as bgp_application
>>
>>    i am getting the following error message.
>>
>> /loading app mybgpapp1.py/
>> /Traceback (most recent call last):/
>> /  File "/usr/local/bin/ryu-manager", line 9, in <module>/
>> /    load_entry_point('ryu==4.22', 'console_scripts', 'ryu-manager')()/
>> /  File "/usr/local/lib/python2.7/dist-packages/ryu/cmd/manager.py",
>> line 98, in main/
>> /    app_mgr.load_apps(app_lists)/
>> /  File "/usr/local/lib/python2.7/dist-packages/ryu/base/app_manager.py",
>> line 415, in load_apps/
>> /    cls = self.load_app(app_cls_name)/
>> /  File "/usr/local/lib/python2.7/dist-packages/ryu/base/app_manager.py",
>> line 392, in load_app/
>> /    mod = utils.import_module(name)/
>> /  File "/usr/local/lib/python2.7/dist-packages/ryu/utils.py", line 99,
>> in import_module/
>> /    return _import_module_file(modname)/
>> /  File "/usr/local/lib/python2.7/dist-packages/ryu/utils.py", line 88,
>> in _import_module_file/
>> /    return load_source(modname, abspath)/
>> /  File "/usr/local/lib/python2.7/dist-packages/ryu/utils.py", line 39,
>> in load_source/
>> /    return imp.load_source(name, pathname)/
>> /  File "/home/mininet/ryu/ryu/services/protocols/bgp/mybgpapp1.py",
>> line 3, in <module>/
>> /    from ryu.services.protocols.bgp import application1 as
>> bgp_application/
>> /ImportError: cannot import name application1/
>>
>> Pls guide. Why am i unable to import from my customized modules?.
>>
>> Thanks
>> Hadem
>>
>>
>>
>> ------------------------------------------------------------
>> ------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>
>>
>>
>> _______________________________________________
>> Ryu-devel mailing list
>> Ryu-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>>
>>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to