Wednesday, March 25, 2020

Help with Python import

Hi list.

I've having troubles understanding how GnuRadio and Python 3.x
in particular should be told to import stuff under
'<GR_INSTALL_ROOT>/lib/site-pages'. I have a 'PYTHONPATH'
containing both:
<GR_INSTALL_ROOT>/lib/site-pages
<GR_INSTALL_ROOT>/lib/site-pages/volk_modtool
etc.

But yet a statement like (in '<GR_INSTALL_ROOT>/bin/volk_modtool.py'):
from volk_modtool import volk_modtool, volk_modtool_config

causes Python 3.x to error out with:
ImportError: cannot import name 'volk_modtool'

But patching it into, it works [1]:

--- a/volk_modtool/volk_modtool.py 2020-02-03 09:55:18
+++ b <GR_INSTALL_ROOT>/bin/volk_modtool.py 2020-03-25 09:44:29
@@ -21,7 +21,7 @@
#


-from volk_modtool import volk_modtool, volk_modtool_config
+from volk_modtool import *
from optparse import OptionParser, OptionGroup

import os
------------------

What does the syntax "from volk_modtool import x, y" require
or do in comparison to the "from volk_modtool import *" syntax?

Anybody care to enlighten a Python newbie?

[1]: volk_modtool.py -m:

(__)
(oo)
/------\/
/ | ||
* /\---/\
~~ ~~

--
--gv

No comments:

Post a Comment