Re: [nox-dev] Importing Nox in Python Without Running Nox
So you need to get the shared libraries loaded. The easiest way of doing this that I can think of is by setting them in the LD_PRELOAD environment variable before starting Python. There might be an easier way, but it doesn't immediately occur to me. I just gave it a try by using "find" to find everything in the NOX build directory with ".so" in it, and then had to manually add in libboost_filesystem.so as well. -- Murphy On Nov 22, 2010, at 9:53 PM, Alec Story wrote: > I'm running a pretty old version of nox, but that change didn't help, I got > the same error: > > [...] > File "/home/openflow/pronto/src/frenetic_net.py", line 14, in <-- > file I'm trying to import without nox running > import nox.lib.core as nox_core > File "/home/openflow/noxcore/build/src/nox/lib/core.py", line 24, in > > from nox.coreapps.pyrt.pycomponent import * > File "/home/openflow/noxcore/build/src/nox/coreapps/pyrt/pycomponent.py", > line 25, in > _pycomponent = swig_import_helper() > File "/home/openflow/noxcore/build/src/nox/coreapps/pyrt/pycomponent.py", > line 21, in swig_import_helper > _mod = imp.load_module('_pycomponent', fp, pathname, description) > ImportError: > /home/openflow/noxcore/build/src/nox/coreapps/pyrt/_pycomponent.so: undefined > symbol: _ZTIN5vigil5EventE > > My version information is: > NOX 0.8.0~core~beta (nox_core), compiled Aug 18 2010 14:32:14 > Compiled with OpenFlow 0x01 > > > On Tue, Nov 23, 2010 at 12:42 AM, Reid Price wrote: > Hi Alec, > > Have you tried just adding the base directory to sys.path? It would be the > level that matches the src/ directory structure, in the built/compiled > version. I think you should then be able to do things like "import > nox.netapps.discovery.discovery as discovery" successfully. Would this help > with what you're trying to do? This worked for me at one point, but I > haven't tried it with recent versions of nox. > > -Reid > > On Mon, Nov 22, 2010 at 9:07 PM, Alec Story wrote: > Hi, > > I'd like to be able to link against nox (for the purpose of running unit > tests that depend on nox but don't actually need it to be running) without > invoking the nox binary, in python. If I try to do this naively by adding > all of nox's subdirectories to sys.path, I get swig errors, so clearly that's > not the right way to do it. > > Is there a way to get this linking to work? > > -- > Alec Story > Cornell University > Biological Sciences, Computer Science 2012 > > ___ > nox-dev mailing list > nox-dev@noxrepo.org > http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org > > > > > > -- > Alec Story > Cornell University > Biological Sciences, Computer Science 2012 > ___ > nox-dev mailing list > nox-dev@noxrepo.org > http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
Re: [nox-dev] Importing Nox in Python Without Running Nox
I'm running a pretty old version of nox, but that change didn't help, I got the same error: [...] File "/home/openflow/pronto/src/frenetic_net.py", line 14, in <-- file I'm trying to import without nox running import nox.lib.core as nox_core File "/home/openflow/noxcore/build/src/nox/lib/core.py", line 24, in from nox.coreapps.pyrt.pycomponent import * File "/home/openflow/noxcore/build/src/nox/coreapps/pyrt/pycomponent.py", line 25, in _pycomponent = swig_import_helper() File "/home/openflow/noxcore/build/src/nox/coreapps/pyrt/pycomponent.py", line 21, in swig_import_helper _mod = imp.load_module('_pycomponent', fp, pathname, description) ImportError: /home/openflow/noxcore/build/src/nox/coreapps/pyrt/_pycomponent.so: undefined symbol: _ZTIN5vigil5EventE My version information is: NOX 0.8.0~core~beta (nox_core), compiled Aug 18 2010 14:32:14 Compiled with OpenFlow 0x01 On Tue, Nov 23, 2010 at 12:42 AM, Reid Price wrote: > Hi Alec, > > Have you tried just adding the base directory to sys.path? It would be the > level that matches the src/ directory structure, in the built/compiled > version. I think you should then be able to do things like "import > nox.netapps.discovery.discovery as discovery" successfully. Would this help > with what you're trying to do? This worked for me at one point, but I > haven't tried it with recent versions of nox. > > -Reid > > On Mon, Nov 22, 2010 at 9:07 PM, Alec Story wrote: > >> Hi, >> >> I'd like to be able to link against nox (for the purpose of running unit >> tests that depend on nox but don't actually need it to be running) without >> invoking the nox binary, in python. If I try to do this naively by adding >> all of nox's subdirectories to sys.path, I get swig errors, so clearly >> that's not the right way to do it. >> >> Is there a way to get this linking to work? >> >> -- >> Alec Story >> Cornell University >> Biological Sciences, Computer Science 2012 >> >> ___ >> nox-dev mailing list >> nox-dev@noxrepo.org >> http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org >> >> > -- Alec Story Cornell University Biological Sciences, Computer Science 2012 ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
Re: [nox-dev] Importing Nox in Python Without Running Nox
Hi Alec, Have you tried just adding the base directory to sys.path? It would be the level that matches the src/ directory structure, in the built/compiled version. I think you should then be able to do things like "import nox.netapps.discovery.discovery as discovery" successfully. Would this help with what you're trying to do? This worked for me at one point, but I haven't tried it with recent versions of nox. -Reid On Mon, Nov 22, 2010 at 9:07 PM, Alec Story wrote: > Hi, > > I'd like to be able to link against nox (for the purpose of running unit > tests that depend on nox but don't actually need it to be running) without > invoking the nox binary, in python. If I try to do this naively by adding > all of nox's subdirectories to sys.path, I get swig errors, so clearly > that's not the right way to do it. > > Is there a way to get this linking to work? > > -- > Alec Story > Cornell University > Biological Sciences, Computer Science 2012 > > ___ > nox-dev mailing list > nox-dev@noxrepo.org > http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org > > ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
[nox-dev] Importing Nox in Python Without Running Nox
Hi, I'd like to be able to link against nox (for the purpose of running unit tests that depend on nox but don't actually need it to be running) without invoking the nox binary, in python. If I try to do this naively by adding all of nox's subdirectories to sys.path, I get swig errors, so clearly that's not the right way to do it. Is there a way to get this linking to work? -- Alec Story Cornell University Biological Sciences, Computer Science 2012 ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org