Python module import failed error

M

matt.doolittle33

Hello all; I am using Ubuntu 12.10 and Python v2.7.3. I am trying to add adirectory to the PYTHONPATH. All of the commands I have found on the web have failed. Please help me to add a directory to the PYHONPATH. The filepath is Home/home/bin. Thanks in advance.
 
C

Chris Angelico

Hello all; I am using Ubuntu 12.10 and Python v2.7.3. I am trying to adda directory to the PYTHONPATH. All of the commands I have found on the web have failed. Please help me to add a directory to the PYHONPATH. The file path is Home/home/bin. Thanks in advance.

What do you mean by that path? That doesn't look like an Ubuntu/Linux
path name. Pull up a terminal (Ctrl-Alt-T should do that for you,
though I haven't used an Ubuntu since 10.10) and see if you can 'ls'
the path - once you have the real path name (it might start with
/home/your_user_name/ for instance), go back to the commands you found
on the web and try them - they'll probably work, then.

ChrisA
 
M

matt.doolittle33

What do you mean by that path? That doesn't look like an Ubuntu/Linux

path name. Pull up a terminal (Ctrl-Alt-T should do that for you,

though I haven't used an Ubuntu since 10.10) and see if you can 'ls'

the path - once you have the real path name (it might start with

/home/your_user_name/ for instance), go back to the commands you found

on the web and try them - they'll probably work, then.
thats the file path. the directory "bin" in my home directory. in bash itobviously looks like this "~/bin" using the file system folder the path is home/Home/bin. i have tried commands like, export PYTHONPATH=${PYTHONPATH}:/users/matt/bin or home/matt/bin or Home/home/bin and nothing has worked.
from what ive found on the web the Python import process is notoriously underspecified, notwithstanding i was under the impression that PYTHONPATH is a global variable that i can add directories to at anytime to tell Python where to look, without having to add some sort of code to every program. isthis impression incorrect? is there some code i need to add to the Pythonprogram call the modules in the "bin" dir?
 
M

matt.doolittle33

What do you mean by that path? That doesn't look like an Ubuntu/Linux

path name. Pull up a terminal (Ctrl-Alt-T should do that for you,

though I haven't used an Ubuntu since 10.10) and see if you can 'ls'

the path - once you have the real path name (it might start with

/home/your_user_name/ for instance), go back to the commands you found

on the web and try them - they'll probably work, then.
thats the file path. the directory "bin" in my home directory. in bash itobviously looks like this "~/bin" using the file system folder the path is home/Home/bin. i have tried commands like, export PYTHONPATH=${PYTHONPATH}:/users/matt/bin or home/matt/bin or Home/home/bin and nothing has worked.
from what ive found on the web the Python import process is notoriously underspecified, notwithstanding i was under the impression that PYTHONPATH is a global variable that i can add directories to at anytime to tell Python where to look, without having to add some sort of code to every program. isthis impression incorrect? is there some code i need to add to the Pythonprogram call the modules in the "bin" dir?
 
C

Chris Angelico

thats the file path. the directory "bin" in my home directory. in bash it obviously looks like this "~/bin" using the file system folder the pathis home/Home/bin. i have tried commands like, export PYTHONPATH=${PYTHONPATH}:/users/matt/bin or home/matt/bin or Home/home/bin and nothing has worked.

Change to that directory, then type 'pwd'. That'll tell you the actual
path. My guess would be /home/matt/bin - note the leading slash.

ChrisA
 
M

matt.doolittle33

My guess would be /home/matt/bin - note the leading slash.

correct. and in the home directory i run export PYTHONPATH=${PYTHONPATH}:/home/matt/bin and have had no luck? am i using the wrong command?
 
M

matt.doolittle33

My guess would be /home/matt/bin - note the leading slash.

correct. and in the home directory i run export PYTHONPATH=${PYTHONPATH}:/home/matt/bin and have had no luck? am i using the wrong command?
 
C

Chris Angelico

My guess would be /home/matt/bin - note the leading slash.

correct. and in the home directory i run export PYTHONPATH=${PYTHONPATH}:/home/matt/bin and have had no luck? am i using the wrong command?

What exactly do you mean by "no luck"? More details would be good.

ChrisA
 
T

Thomas Calmant

Hi,

Do you run Python in the same terminal than where you run the export
command ?

++
Thomas
 
M

Mark Lawrence

My guess would be /home/matt/bin - note the leading slash.

correct. and in the home directory i run export PYTHONPATH=${PYTHONPATH}:/home/matt/bin and have had no luck? am i using the wrong command?

What is PYTHONPATH actually set to? You can find out by running python
interactively, then

import os
os.environ['PYTHONPATH']
 
M

matt.doolittle33

What exactly do you mean by "no luck"? More details would be good.

The program i am using (GNU radio companion) that wants to import the modules from the ~/bin folder shows this error:

Block - import_0_0_0 - Import(import):
Param - Import(import):
Import "import multimode_helper as mh" failed.

..
 
M

matt.doolittle33

What exactly do you mean by "no luck"? More details would be good.

The program i am using (GNU radio companion) that wants to import the modules from the ~/bin folder shows this error:

Block - import_0_0_0 - Import(import):
Param - Import(import):
Import "import multimode_helper as mh" failed.

..
 
M

matt.doolittle33

Hi,

Do you run Python in the same terminal than where you run the export command ?

no i dont. the python program looking for the modules in the ~/bin directory is called GNU radio companion.
 
M

matt.doolittle33

Hi,

Do you run Python in the same terminal than where you run the export command ?

no i dont. the python program looking for the modules in the ~/bin directory is called GNU radio companion.
 
M

matt.doolittle33

Does anyone know why i keep having these double posts? please excuse them; i am a super newbie to this forum (and python obviously).

Thanks
 
M

matt.doolittle33

Does anyone know why i keep having these double posts? please excuse them; i am a super newbie to this forum (and python obviously).

Thanks
 
M

matt.doolittle33

What is PYTHONPATH actually set to?


OK so i ran python and then :

import sys
sys.path

bash returned:

['', '/home/matt', '/users/matt/bin', '/home/matt/bin', '/Home/bin', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PIL', '/usr/lib/python2.7/dist-packages/gst-0..10', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client', '/usr/lib/python2.7/dist-packages/ubuntuone-client', '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel', '/usr/lib/python2.7/dist-packages/ubuntuone-couch', '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol', '/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode']

so the paths i have been adding are there. should i be adding the python file names in the "bin" directory as well?
 
M

matt.doolittle33

What is PYTHONPATH actually set to?


OK so i ran python and then :

import sys
sys.path

bash returned:

['', '/home/matt', '/users/matt/bin', '/home/matt/bin', '/Home/bin', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PIL', '/usr/lib/python2.7/dist-packages/gst-0..10', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client', '/usr/lib/python2.7/dist-packages/ubuntuone-client', '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel', '/usr/lib/python2.7/dist-packages/ubuntuone-couch', '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol', '/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode']

so the paths i have been adding are there. should i be adding the python file names in the "bin" directory as well?
 

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

Forum statistics

Threads
474,141
Messages
2,570,817
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top