467,886 Members | 1,790 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,886 developers. It's quick & easy.

modules path

Hi there,

I moved a few modules into the modules folder (on OSX: /opt/local/lib/
python2.5/site-packages/).
They don't show up though when I start IDLE...

Is there a way to reload the modules folders in sys.path without
logging out and back in?

something like "source .cshrc" in a shell...
thanks in advance,

Arno
Sep 6 '08 #1
  • viewed: 1749
Share:
4 Replies
On Sep 7, 8:03*am, Python <pyt...@rgbaz.euwrote:
Hi there,

I moved a few modules into the modules folder (on OSX: /opt/local/lib/
python2.5/site-packages/).
They don't show up though when I start IDLE...

Is there a way to reload the modules folders in sys.path without *
logging out and back in?
I know nothing about OS X, but no "reload" step should be necessary.
Each Python process, whether run from IDLE or some other tool or from
the shell, will form its own idea of sys.path.

So: What modules? What type of file (.py, .pyc, .egg, .zip, .so) are
you talking about? Did their documentation say that moving the files
into site-packages was all the installation that was needed? What does
"don't show up when I start IDLE" mean?

When you start IDLE and do
import sys, pprint
pprint.pprint(sys.path)
do you see the site-packages directory containing the module files?

What happens when you do
import amodule # substitute correct module name here
?

Repeat the above two steps for each of
(1) running Python from the shell
(2) running Python from the shell with the -v option

HTH,
John
Sep 6 '08 #2

On 7 sep 2008, at 00:25, John Machin wrote:
On Sep 7, 8:03 am, Python <pyt...@rgbaz.euwrote:
>Hi there,

I moved a few modules into the modules folder (on OSX: /opt/local/
lib/
python2.5/site-packages/).
They don't show up though when I start IDLE...

Is there a way to reload the modules folders in sys.path without
logging out and back in?

I know nothing about OS X, but no "reload" step should be necessary.
Each Python process, whether run from IDLE or some other tool or from
the shell, will form its own idea of sys.path.

So: What modules? What type of file (.py, .pyc, .egg, .zip, .so) are
you talking about? Did their documentation say that moving the files
into site-packages was all the installation that was needed? What does
"don't show up when I start IDLE" mean?

When you start IDLE and do
import sys, pprint
pprint.pprint(sys.path)
do you see the site-packages directory containing the module files?

What happens when you do
import amodule # substitute correct module name here
?

Repeat the above two steps for each of
(1) running Python from the shell
(2) running Python from the shell with the -v option

HTH,
John
--
I installed pyGTK from MacPorts
for some reason Macports installs these modules in the /opt/ folder
even in an old python folder: python 2.4, while my current version is
2.5
both are not in sys.path...

i appended the path and IDLE found them
I should have thought a bit more before asking...
saturday night... why am I here anyway ;)

now one question came up, how do I make those path permanent?
i mean, sys.path.append(<path)adds it for the current session,
yet when i logout of IDLE and start it again it's gone...
how do i keep it in there?

thanks for the answer John...

Arno

Sep 6 '08 #3
En Sat, 06 Sep 2008 20:26:24 -0300, Python <py****@rgbaz.euescribió:
now one question came up, how do I make those path permanent?
i mean, sys.path.append(<path)adds it for the current session,
yet when i logout of IDLE and start it again it's gone...
how do i keep it in there?
You can add that path to the PYTHONPATH environment variable, or you can put a .pth file in the current Lib directory, containing the desired path.
See http://docs.python.org/inst/search-path.html and the documentation for the site module (although it appears not to be totally accurate).

--
Gabriel Genellina

Sep 7 '08 #4

On 7 sep 2008, at 13:50, Gabriel Genellina wrote:
En Sat, 06 Sep 2008 20:26:24 -0300, Python <py****@rgbaz.euescribió:
>now one question came up, how do I make those path permanent?
i mean, sys.path.append(<path)adds it for the current session,
yet when i logout of IDLE and start it again it's gone...
how do i keep it in there?

You can add that path to the PYTHONPATH environment variable, or you
can put a .pth file in the current Lib directory, containing the
desired path.
See http://docs.python.org/inst/search-path.html and the
documentation for the site module (although it appears not to be
totally accurate).

--
Gabriel Genellina

i read that but was wondering why some modules installed by macports
did show up
in the path and some didn't
the PYTHONPATH wasn't set anywhere in my shell

I did add it and now it works!

Thanks John & Gabriel!

gr
Arno
Sep 7 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Robin Becker | last post: by
reply views Thread by Nick Coghlan | last post: by
15 posts views Thread by Nick Coghlan | last post: by
2 posts views Thread by Joseph Turian | last post: by
11 posts views Thread by fortepianissimo | last post: by
1 post views Thread by Frank | last post: by
reply views Thread by Martin P. Hellwig | last post: by
4 posts views Thread by srinivas | last post: by
reply views Thread by MrMoon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.