Hey Michael, Hey Kevin, Hey all,
thanks for your help!
I found that by specifying the python version I want to use when running the
file, everything works fine. Like this:
python2.7 if_else_mod.py
This would be acceptable for me, however, I decided to do some of the stuff you
suggested. I get the following output when running env:
Patricks-iMac:~ patrick$ env
TERM_PROGRAM=Apple_Terminal
SHELL=/bin/bash
TERM=xterm-256color
TMPDIR=/var/folders/3j/qy7_9bpx29g_nf_ymbkw_td00000gn/T/
Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.11PeMdZFpD/Render
TERM_PROGRAM_VERSION=343.7
TERM_SESSION_ID=1FC9A988-7B1E-4869-95D3-5FF71F9942F7
USER=patrick
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.0PyXsYlSwi/Listeners
__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x3
PATH=/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
PWD=/Users/patrick
DBUS_LAUNCHD_SESSION_BUS_SOCKET=/private/tmp/com.apple.launchd.dJkzL2MOo1/unix_domain_listener
LANG=de_DE.UTF-8
XPC_FLAGS=0x0
XPC_SERVICE_NAME=0
SHLVL=1
HOME=/Users/patrick
LOGNAME=patrick
DISPLAY=/private/tmp/com.apple.launchd.KWH6aSklFz/org.macosforge.xquartz:0
_=/usr/bin/env
I see that I only have a PATH variable set, but no PYTHONPATH. And
/opt/local/bin seems to be the first in place?! With
Patricks-iMac:bin patrick$ pwd
/usr/bin
Patricks-iMac:bin patrick$ ./py
pydoc python python2.6-config pythonw
pydoc2.6 python-config python2.7 pythonw2.6
pydoc2.7 python2.6 python2.7-config pythonw2.7
I see that I have even more python installs. Now I ran
Patricks-iMac:bin patrick$ which python
/usr/bin/python
Patricks-iMac:bin patrick$ port select --list python
Available versions for python:
none (active)
python26-apple
python27
python27-apple
So terminal normally would run "python" (didn’t look up the version). And
MacPorts?
All this is what comes out of a clean OS X 10.9 install with an update to 10.10
and then a GNURadio install via MacPorts. Didn’t try yet to change one of the
env variables or use the 'sudo port select python python27‘ command. What would
your suggestions now be? What I don’t understand is why I have to tell MacPorts
to use python2.7, if in fact I want to tell that to my terminal?
Thanks & Regards
Patrick
> Am 08.09.2015 um 03:04 schrieb Michael Dickens <[email protected]>:
>
> Hi Patrick - So what's happening is that with GRC, because it was
> installed via MacPorts the MP version of Python is used. The terminal
> only knows what you tell it via environment variables such as PYTHONPATH
> (already suggested by Kevin Hofschröer) and PATH. In your case right
> now, I'll bet that the PATH contains /usr/bin before /opt/local/bin (if
> the latter is listed at all). If you do "which python", you'll see what
> your shell is executing when you type "python" (again, better
> /usr/bin/python [2.7 something]). Even if you add /opt/local/bin at the
> start of PATH, you might still need to tell MP to select the version of
> Python you want to use when you type "python" in the shell. You can list
> the options port has via "port select --list python", and then select
> Python 2.7 via "sudo port select python python27" if it not already
> active. Combining this with making sure /opt/local/bin comes first in
> PATH should solve your issue. Hope this helps! - MLD
>
> On Mon, Sep 7, 2015, at 12:29 PM, Patrick Krämer wrote:
>> I installed GNURadio on a fresh machine with Mac OS X 10.10.5 via
>> MacPorts. I now have 2 Python installs in /usr/bin, python2.6 and
>> python2.7. Running flowgraphs with GRC is no problem. However, when
>> trying to run a .py-file from the terminal, as suggested in the guided
>> tutorial 3.1 („if else“) some modules are not found:
>>
>> Patricks-iMac:work patrick$ python if_else_mod.py Traceback (most
>> recent call last): File "if_else_mod.py", line 18, in <module>
>> from PyQt4 import Qt ImportError: No module named PyQt4
>>
>>
>> Why does it work, when running the file from GRC? Is my terminal using
>> the wrong python install? How could I change that? I also tried
>> changing the path variable on my notebook a few days ago, when I ran
>> into the same problem. But since I am new to python and the command
>> line I obviously made a mistake so that at some point I could not
>> start the GRC anymore. So your help is appreciated and needed.
>> Couldn’t find a similar question in the archives.
>
> _______________________________________________
> Discuss-gnuradio mailing list
> [email protected]
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
_______________________________________________
Discuss-gnuradio mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio