Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #39228 > unrolled thread
| Started by | matt.doolittle33@gmail.com |
|---|---|
| First post | 2013-02-19 07:23 -0800 |
| Last post | 2013-02-19 08:17 -0800 |
| Articles | 20 on this page of 29 — 7 participants |
Back to article view | Back to comp.lang.python
Python module import failed error matt.doolittle33@gmail.com - 2013-02-19 07:23 -0800
Re: Python module import failed error Chris Angelico <rosuav@gmail.com> - 2013-02-20 02:29 +1100
Re: Python module import failed error matt.doolittle33@gmail.com - 2013-02-19 08:17 -0800
Re: Python module import failed error Chris Angelico <rosuav@gmail.com> - 2013-02-20 03:25 +1100
Re: Python module import failed error matt.doolittle33@gmail.com - 2013-02-19 08:28 -0800
Re: Python module import failed error Chris Angelico <rosuav@gmail.com> - 2013-02-20 03:39 +1100
Re: Python module import failed error matt.doolittle33@gmail.com - 2013-02-19 08:51 -0800
Re: Python module import failed error matt.doolittle33@gmail.com - 2013-02-19 08:51 -0800
Re: Python module import failed error Thomas Calmant <thomas.calmant@gmail.com> - 2013-02-19 17:44 +0100
Re: Python module import failed error matt.doolittle33@gmail.com - 2013-02-19 08:54 -0800
Re: Python module import failed error matt.doolittle33@gmail.com - 2013-02-19 08:54 -0800
Re: Python module import failed error Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-02-19 16:47 +0000
Re: Python module import failed error matt.doolittle33@gmail.com - 2013-02-19 08:57 -0800
Re: Python module import failed error Dave Angel <davea@davea.name> - 2013-02-19 12:20 -0500
Re: Python module import failed error matt.doolittle33@gmail.com - 2013-02-19 09:45 -0800
Re: Python module import failed error Chris Angelico <rosuav@gmail.com> - 2013-02-20 08:46 +1100
Re: Python module import failed error matt.doolittle33@gmail.com - 2013-02-19 09:45 -0800
Re: Python module import failed error Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-02-19 17:22 +0000
Re: Python module import failed error matt.doolittle33@gmail.com - 2013-02-19 13:24 -0800
Re: Python module import failed error Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-02-19 19:36 -0500
Re: Python module import failed error matt.doolittle33@gmail.com - 2013-02-19 08:57 -0800
Re: Python module import failed error matt.doolittle33@gmail.com - 2013-02-19 09:10 -0800
Double posts (was Re: Python module import failed error) Lele Gaifax <lele@metapensiero.it> - 2013-02-19 19:17 +0100
Re: Double posts (was Re: Python module import failed error) matt.doolittle33@gmail.com - 2013-02-19 10:31 -0800
Re: Python module import failed error matt.doolittle33@gmail.com - 2013-02-19 09:10 -0800
Re: Python module import failed error matt.doolittle33@gmail.com - 2013-02-19 09:20 -0800
Re: Python module import failed error matt.doolittle33@gmail.com - 2013-02-19 09:20 -0800
Re: Python module import failed error matt.doolittle33@gmail.com - 2013-02-19 08:28 -0800
Re: Python module import failed error matt.doolittle33@gmail.com - 2013-02-19 08:17 -0800
Page 1 of 2 [1] 2 Next page →
| From | matt.doolittle33@gmail.com |
|---|---|
| Date | 2013-02-19 07:23 -0800 |
| Subject | Python module import failed error |
| Message-ID | <3c0e501e-cc5b-434e-b65b-0d4ffce82af9@googlegroups.com> |
Hello all; I am using Ubuntu 12.10 and Python v2.7.3. I am trying to add a 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.
[toc] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2013-02-20 02:29 +1100 |
| Message-ID | <mailman.2029.1361287750.2939.python-list@python.org> |
| In reply to | #39228 |
On Wed, Feb 20, 2013 at 2:23 AM, <matt.doolittle33@gmail.com> wrote: > Hello all; I am using Ubuntu 12.10 and Python v2.7.3. I am trying to add a 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
[toc] | [prev] | [next] | [standalone]
| From | matt.doolittle33@gmail.com |
|---|---|
| Date | 2013-02-19 08:17 -0800 |
| Message-ID | <8c9e791f-1c8f-434e-b009-d234c45e1964@googlegroups.com> |
| In reply to | #39230 |
>
> 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 it obviously 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. is this impression incorrect? is there some code i need to add to the Python program call the modules in the "bin" dir?
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2013-02-20 03:25 +1100 |
| Message-ID | <mailman.2042.1361291150.2939.python-list@python.org> |
| In reply to | #39243 |
On Wed, Feb 20, 2013 at 3:17 AM, <matt.doolittle33@gmail.com> wrote:
> 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 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.
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
[toc] | [prev] | [next] | [standalone]
| From | matt.doolittle33@gmail.com |
|---|---|
| Date | 2013-02-19 08:28 -0800 |
| Message-ID | <f1112fc5-e170-409b-bc21-4989535692c2@googlegroups.com> |
| In reply to | #39245 |
My guess would be /home/matt/bin - note the leading slash.
>
>
>
> ChrisA
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?
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2013-02-20 03:39 +1100 |
| Message-ID | <mailman.2044.1361291957.2939.python-list@python.org> |
| In reply to | #39246 |
On Wed, Feb 20, 2013 at 3:28 AM, <matt.doolittle33@gmail.com> wrote:
> My guess would be /home/matt/bin - note the leading slash.
>>
>>
>>
>> ChrisA
>
> 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
[toc] | [prev] | [next] | [standalone]
| From | matt.doolittle33@gmail.com |
|---|---|
| Date | 2013-02-19 08:51 -0800 |
| Message-ID | <c3211c20-2aab-4e11-b067-bc238f01b169@googlegroups.com> |
| In reply to | #39248 |
On Tuesday, February 19, 2013 11:39:14 AM UTC-5, Chris Angelico wrote:>
>
> 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.
.
[toc] | [prev] | [next] | [standalone]
| From | matt.doolittle33@gmail.com |
|---|---|
| Date | 2013-02-19 08:51 -0800 |
| Message-ID | <mailman.2047.1361292717.2939.python-list@python.org> |
| In reply to | #39248 |
On Tuesday, February 19, 2013 11:39:14 AM UTC-5, Chris Angelico wrote:>
>
> 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.
.
[toc] | [prev] | [next] | [standalone]
| From | Thomas Calmant <thomas.calmant@gmail.com> |
|---|---|
| Date | 2013-02-19 17:44 +0100 |
| Message-ID | <mailman.2045.1361292288.2939.python-list@python.org> |
| In reply to | #39246 |
[Multipart message — attachments visible in raw view] — view raw
Hi,
Do you run Python in the same terminal than where you run the export
command ?
++
Thomas
2013/2/19 <matt.doolittle33@gmail.com>
> My guess would be /home/matt/bin - note the leading slash.
> >
> >
> >
> > ChrisA
>
> 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?
> --
> http://mail.python.org/mailman/listinfo/python-list
>
[toc] | [prev] | [next] | [standalone]
| From | matt.doolittle33@gmail.com |
|---|---|
| Date | 2013-02-19 08:54 -0800 |
| Message-ID | <fd371cd5-1e17-4d78-987a-4daf8d2e5b02@googlegroups.com> |
| In reply to | #39249 |
On Tuesday, February 19, 2013 11:44:32 AM UTC-5, Thomas Calmant wrote: > 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.
[toc] | [prev] | [next] | [standalone]
| From | matt.doolittle33@gmail.com |
|---|---|
| Date | 2013-02-19 08:54 -0800 |
| Message-ID | <mailman.2048.1361292881.2939.python-list@python.org> |
| In reply to | #39249 |
On Tuesday, February 19, 2013 11:44:32 AM UTC-5, Thomas Calmant wrote: > 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.
[toc] | [prev] | [next] | [standalone]
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2013-02-19 16:47 +0000 |
| Message-ID | <mailman.2046.1361292411.2939.python-list@python.org> |
| In reply to | #39246 |
On 19/02/2013 16:28, matt.doolittle33@gmail.com wrote:
> My guess would be /home/matt/bin - note the leading slash.
>>
>>
>>
>> ChrisA
>
> 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']
--
Cheers.
Mark Lawrence
[toc] | [prev] | [next] | [standalone]
| From | matt.doolittle33@gmail.com |
|---|---|
| Date | 2013-02-19 08:57 -0800 |
| Message-ID | <f3c7ce42-5832-41f7-88e1-4319f3665657@googlegroups.com> |
| In reply to | #39250 |
> What is PYTHONPATH actually set to? You can find out by running python > > interactively, then i dont know. how do i run pythoin interactively?
[toc] | [prev] | [next] | [standalone]
| From | Dave Angel <davea@davea.name> |
|---|---|
| Date | 2013-02-19 12:20 -0500 |
| Message-ID | <mailman.2052.1361294466.2939.python-list@python.org> |
| In reply to | #39255 |
On 02/19/2013 11:57 AM, matt.doolittle33@gmail.com wrote:
>
>> What is PYTHONPATH actually set to? You can find out by running python
>>
>> interactively, then
>
> i dont know. how do i run pythoin interactively?
>
By typing the simple command 'python'
davea@think2:~$ python
Python 2.7.3 (default, Aug 1 2012, 05:14:39)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
But since you're running some non-python program which is in turn
launching python, perhaps you'd better give more details. And not
scattered over a half dozen tiny emails, but all at once.
Do you, in a single terminal, do the export, then run the
gnuradiocompanion.py ? And does the error message/stacktrace appear in
the same terminal window?
Please show us just what you're running, from start to finish. Thanks.
--
DaveA
[toc] | [prev] | [next] | [standalone]
| From | matt.doolittle33@gmail.com |
|---|---|
| Date | 2013-02-19 09:45 -0800 |
| Message-ID | <d8744ff0-54de-4ebd-8972-d3f595f242f2@googlegroups.com> |
| In reply to | #39262 |
>
> gnuradiocompanion.py ? And does the error message/stacktrace appear in
>
> the same terminal window?
>
hi. ok so i am trying to run the python module (multimode_helper.py) in the GNU radio companion (GRC) which is sort of like an IDE which lets you organize code blocks by arranging them in a flow graph instead of having to write the code that would call the blocks in some particular order. GRC shows the import error in its flow graph error viewer:
Error 0:
Block - import_0_0_0 - Import(import):
Param - Import(import):
Import "import multimode_helper as mh" failed.
The directory /home/matt/bin contains "multimode_helper.py" and this file path is in the PYTHONPATH. I still get the import error however. so now that i know the file path is in PYTHONPATH but i am still getting the import error i am really confused here.
Thanks for your attention.
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2013-02-20 08:46 +1100 |
| Message-ID | <mailman.2066.1361310384.2939.python-list@python.org> |
| In reply to | #39264 |
On Wed, Feb 20, 2013 at 4:45 AM, <matt.doolittle33@gmail.com> wrote: > The directory /home/matt/bin contains "multimode_helper.py" and this file path is in the PYTHONPATH. I still get the import error however. so now that i know the file path is in PYTHONPATH but i am still getting the import error i am really confused here. Do you understand how Unix environment variables work? You're using the 'export' command, but that doesn't make any sort of global change - it still applies only to things done in the same session. (Actually, your change applies only to children of the shell where you do it... but never mind that now.) You may do better by putting the export command into your .bashrc - that would apply to all sessions created by your user. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | matt.doolittle33@gmail.com |
|---|---|
| Date | 2013-02-19 09:45 -0800 |
| Message-ID | <mailman.2054.1361295940.2939.python-list@python.org> |
| In reply to | #39262 |
>
> gnuradiocompanion.py ? And does the error message/stacktrace appear in
>
> the same terminal window?
>
hi. ok so i am trying to run the python module (multimode_helper.py) in the GNU radio companion (GRC) which is sort of like an IDE which lets you organize code blocks by arranging them in a flow graph instead of having to write the code that would call the blocks in some particular order. GRC shows the import error in its flow graph error viewer:
Error 0:
Block - import_0_0_0 - Import(import):
Param - Import(import):
Import "import multimode_helper as mh" failed.
The directory /home/matt/bin contains "multimode_helper.py" and this file path is in the PYTHONPATH. I still get the import error however. so now that i know the file path is in PYTHONPATH but i am still getting the import error i am really confused here.
Thanks for your attention.
[toc] | [prev] | [next] | [standalone]
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2013-02-19 17:22 +0000 |
| Message-ID | <mailman.2053.1361294590.2939.python-list@python.org> |
| In reply to | #39255 |
On 19/02/2013 16:57, matt.doolittle33@gmail.com wrote: > >> What is PYTHONPATH actually set to? You can find out by running python >> >> interactively, then > > i dont know. how do i run pythoin interactively? > Type python at a command prompt :) -- Cheers. Mark Lawrence
[toc] | [prev] | [next] | [standalone]
| From | matt.doolittle33@gmail.com |
|---|---|
| Date | 2013-02-19 13:24 -0800 |
| Message-ID | <dc1e2874-e2fe-4853-b4e4-4a0abdbce523@googlegroups.com> |
| In reply to | #39263 |
Here is the PYTHONPATH >>> import sys >>> sys.path ['', '/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']
[toc] | [prev] | [next] | [standalone]
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| Date | 2013-02-19 19:36 -0500 |
| Message-ID | <mailman.2074.1361320623.2939.python-list@python.org> |
| In reply to | #39279 |
On Tue, 19 Feb 2013 13:24:39 -0800 (PST), matt.doolittle33@gmail.com
declaimed the following in gmane.comp.python.general:
> Here is the PYTHONPATH
>
> >>> import sys
> >>> sys.path
> ['', '/home/matt', '/users/matt/bin', '/home/matt/bin', '/Home/bin', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2',
And that already looks like a mess...
Do you actually have separate directories named
/home
and
/Home
(Linux/UNIX is case sensitive)
And do you really have your account split between
/home/matt
and
/users/matt
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | comp.lang.python
csiph-web