Trouble with importing

B

Ben

In brief summary, I have installed gnuradio [gnuradio.org] and the
gen2_rfid module [https://www.cgran.org/wiki/Gen2] on Ubuntu 10.04,
with all installed packages up to date as of a few days ago.

When I try to run the rfid reader/decoder script, I get the following
error:


ben@sdrfid:~/gen2_rfid/trunk/src/app$ sudo nice -n 20 ./
reader_decoder.py
Traceback (most recent call last):
File "./reader_decoder.py", line 3, in <module>
from gnuradio import gr, gru, rfid

It is the "rfid" module that is causing the problem. The strange
thing is that

ben@sdrfid:~/gen2_rfid/trunk/src/app$ python -c "from gnuradio import
rfid"

works fine (at least, it doesn't say anything, which I take to be a
good sign), but

ben@sdrfid:~/gen2_rfid/trunk/src/app$ sudo python -c "from gnuradio
import rfid"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: cannot import name rfid

Causes an error.

sudo echo $PYTHONPATH yields the same result as echo $PYTHONPATH so I
don't think it's an issue of path.

Can anyone suggest something that might be causing this problem?

Ben
 
J

Jerry Hill

ben@sdrfid:~/gen2_rfid/trunk/src/app$ python -c "from gnuradio import
rfid"

works fine (at least, it doesn't say anything, which I take to be a
good sign), but

ben@sdrfid:~/gen2_rfid/trunk/src/app$ sudo python -c "from gnuradio
import rfid"
Traceback (most recent call last):
 File "<string>", line 1, in <module>
ImportError: cannot import name rfid

What are the permissions on the gnuradio package and the rfid module?
Do you see anything interesting if you run python with -v or -vv?
Like this:
sudo python -v -c "from gnuradio import rfid
 
J

Jerry Hill

Jerry, thanks for the reply, I was swamped with other things for the
better part of a week.. Anyway, I tried using the verbose flag when
attempting the import.  I didn't see anything that meant anything to
me, but here's the bit surrounding the part where it fails:

# /usr/lib/python2.6/dist-packages/gnuradio/__init__.pyc matches
/usr/lib/python2.6/dist-packages/gnuradio/__init__.py
import gnuradio # precompiled from
/usr/lib/python2.6/dist-packages/gnuradio/__init__.pyc
# /usr/lib/python2.6/re.pyc matches /usr/lib/python2.6/re.py
import re # precompiled from /usr/lib/python2.6/re.pyc
# /usr/lib/python2.6/sre_compile.pyc matches /usr/lib/python2.6/sre_compile.py
import sre_compile # precompiled from /usr/lib/python2.6/sre_compile.pyc
import _sre # builtin
# /usr/lib/python2.6/sre_parse.pyc matches /usr/lib/python2.6/sre_parse.py
import sre_parse # precompiled from /usr/lib/python2.6/sre_parse.pyc
# /usr/lib/python2.6/sre_constants.pyc matches
/usr/lib/python2.6/sre_constants.py
import sre_constants # precompiled from /usr/lib/python2.6/sre_constants.pyc
Traceback (most recent call last):
 File "<string>", line 1, in <module>
ImportError: cannot import name rfid
# clear __builtin__._
# clear sys.path
# clear sys.argv


As for the permissions, as a bit of a python novice, I wasn't sure
whether permissions on the package referred to the gnuradio folder or
to something else.  The permissions on the gnuradio folder are
drwxr-sr-x.  I have sort of the same problem with the rfid module, but
hopefully this gives you the info you were asking about:

-rwxr-xr-x 1 root staff   1067 2010-10-14 15:27 _rfid.la
-rw-r--r-- 1 root staff  17988 2010-10-14 15:27 rfid.py
-rw-r--r-- 1 root staff  30771 2010-10-14 15:27 rfid.pyc
-rw-r--r-- 1 root staff  30771 2010-10-14 15:27 rfid.pyo
-rwxr-xr-x 1 root staff 939872 2010-10-14 15:27 _rfid.so


Thanks again for giving this some thought.  Let me know if you have
any other tips!

I'm copying your reply back to the list. You'll get more and better
responses if you keep all of the discussion on there.

I don't see anything unusual going on there either. I do see that the
project page for gen2_rfid is asking for a particular SVN revision of
gnuradio with custom edits applied. Is that how you installed
gnuradio? I'm looking at the notes in
https://www.cgran.org/browser/projects/gen2_rfid/trunk/README.txt and
https://www.noisebridge.net/wiki/RFID_Hacking/usrp/
 
B

Ben Ahrens

I did indeed use the particular revision compiled with the addons. I
discovered that if I log in as root or make myself a user with full
privileges I can successfully import the rfid module, just not using
sudo. Of course neither of those options are particularly good ones,
but that's the only way I've gotten it to work thus far.

Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top