ImportError: No module named

Hi all,

I have created a new module called Tool_NetworkCoding. During the
installation, I did not get any error message, everything went well. But
when I run a grc file to test some blocks inside this new module, it
turned
out an error message:

Traceback (most recent call last): File
“/home/van-ly/Downloads/top_block.py”, line 16, in import
Tool_NetworkCodingImportError: No module named Tool_NetworkCoding

Please help me with this.
Thank you in advance
Van-Ly

Nguyen Van-Ly,
Vietnam National University, Hanoi - VNU
University of Engineering and Technology - UET
Faculty of Electronics and Telecommunications - FET

Tel: +84 978 819 406

Standing on my own two feet !!!

Hi Van-Ly,

if you installed everything correctly, Python should be able to find the
module.
You can verify this by looking at the install_manifest.txt in your OOT’s
build/ directory, in which there should be an entry for every file it
copied.
Find your python files (there always should be an init.py) and check
if the target location is part of your $PYTHONPATH.

Greetings,
Marcus

Hi Marcus,

I’ve gotten a surprising thing and I couldn’t explain why.
First, I type: sudo gnuradio-companion to open the GNUradio and test my
own
module. It turned out an error message as I described in the previous
mail.
(ImportError: No module named Tool_NetworkCoding)
However, when I just type: gnuradio-companion and also run the same grc
file, the error message disappeared, and everything then seems to go
well.
So, is there any difference between sudo gnuradio-companion and
gnuradio-companion ?

Thank you very much
Van-Ly

Nguyen Van-Ly,
Vietnam National University, Hanoi - VNU
University of Engineering and Technology - UET
Faculty of Electronics and Telecommunications - FET

Tel: +84 978 819 406

On Wed, Jul 23, 2014 at 6:47 PM, Marcus Müller
[email protected]

On Wed, Jul 23, 2014 at 10:32 AM, Nguyễn Văn Lý
[email protected]
wrote:

Thank you very much
Van-Ly

Yes. Using sudo, you’re running as root with root’s environment that
usually doesn’t know about things in /usr/local (PATH, PYTHONPATH,
LD_LIBRARY_PATH, etc.). You should not be running gnuradio-companion as
root, anyways. No need to sudo everything!

Tom

Hi Van-Ly,

So, is there any difference between sudo gnuradio-companion and
gnuradio-companion ?

Yes, the “sudo” part :wink:
sudo is used to make a program run under a different user, and in a
different environment. For example, sudo gnuradio-companion runs
gnuradio-companion as root. Why did you do that?

But that doesn’t set the PYTHONPATH environment, so python can’t find
the modules you installed to your local python package prefix.

Greetings,
Marcus

Thanks Tom and Marcus,

So it’s not necessary to run sudo gnuradio-companion at all :slight_smile:

Van-Ly
p/s: I am new to almost everything that I’m working with, from ubuntu to
gnuradio :slight_smile: just glad to talk to you :slight_smile:

Nguyen Van-Ly,
Vietnam National University, Hanoi - VNU
University of Engineering and Technology - UET
Faculty of Electronics and Telecommunications - FET

Tel: +84 978 819 406

On Wed, Jul 23, 2014 at 9:43 PM, Marcus Müller
[email protected]

Glad to have you here, too!

Just a word of advice: this is not a linux support channel. We really
like being helpful, so it’s ok to ask things related to GNU Radio and
the system it runs on, but if you want linux help, you might want to go
online in IRC and join the #ubuntu channel on irc.freenode.org , using
either a desktop client of your choice (e.g. Pidgin) or the web client
at http://webchat.freenode.net/

Greetings,
Marcus

Thanks a lot Marcus :slight_smile:

Nguyen Van-Ly,
Vietnam National University, Hanoi - VNU
University of Engineering and Technology - UET
Faculty of Electronics and Telecommunications - FET

Tel: +84 978 819 406

On Wed, Jul 23, 2014 at 9:58 PM, Marcus Müller
[email protected]