ez_setup.py

N

Nader Emami

L.S.,

I have installed locally Python-2.4.4 without any problem. Then I would
install the "ez_setup.py" to be able using of "easy_install" tool, but I
get the next error:

%python ez_setup.py
Traceback (most recent call last):
File "ez_setup.py", line 223, in ?
main(sys.argv[1:])
File "ez_setup.py", line 155, in main
egg = download_setuptools(version, delay=0)
File "ez_setup.py", line 111, in download_setuptools
import urllib2, shutil
File "/usr/people/emami/lib/python2.4/urllib2.py", line 108, in ?
import cookielib
File "/usr/people/emami/lib/python2.4/cookielib.py", line 35, in ?
from calendar import timegm
File "/usr/people/emami/calendar.py", line 23, in ?
import pygtk
ImportError: No module named pygtk

I don't understand what is the problem! Could somebody tell me what I
have to do to solve it?

Regards,
Nader
 
T

Tim Golden

Nader said:
L.S.,

I have installed locally Python-2.4.4 without any problem. Then I would
install the "ez_setup.py" to be able using of "easy_install" tool, but I
get the next error:

%python ez_setup.py
Traceback (most recent call last):
File "ez_setup.py", line 223, in ?
main(sys.argv[1:])
File "ez_setup.py", line 155, in main
egg = download_setuptools(version, delay=0)
File "ez_setup.py", line 111, in download_setuptools
import urllib2, shutil
File "/usr/people/emami/lib/python2.4/urllib2.py", line 108, in ?
import cookielib
File "/usr/people/emami/lib/python2.4/cookielib.py", line 35, in ?
from calendar import timegm
File "/usr/people/emami/calendar.py", line 23, in ?
import pygtk
ImportError: No module named pygtk

I don't understand what is the problem! Could somebody tell me what I
have to do to solve it?


You have a module called "calendar" in your user directory
/usr/people/emami/calendar.py which is shadowing the stdlib
calendar module -- which doesn't get used much so you've
probably never noticed. Either rename your local one or take
your home folder off the Python path... at least for long enough
for ez_setup to do its stuff.

TJG
 
N

Nader Emami

Tim said:
Nader said:
L.S.,

I have installed locally Python-2.4.4 without any problem. Then I
would install the "ez_setup.py" to be able using of "easy_install"
tool, but I get the next error:

%python ez_setup.py
Traceback (most recent call last):
File "ez_setup.py", line 223, in ?
main(sys.argv[1:])
File "ez_setup.py", line 155, in main
egg = download_setuptools(version, delay=0)
File "ez_setup.py", line 111, in download_setuptools
import urllib2, shutil
File "/usr/people/emami/lib/python2.4/urllib2.py", line 108, in ?
import cookielib
File "/usr/people/emami/lib/python2.4/cookielib.py", line 35, in ?
from calendar import timegm
File "/usr/people/emami/calendar.py", line 23, in ?
import pygtk
ImportError: No module named pygtk

I don't understand what is the problem! Could somebody tell me what I
have to do to solve it?


You have a module called "calendar" in your user directory
/usr/people/emami/calendar.py which is shadowing the stdlib
calendar module -- which doesn't get used much so you've
probably never noticed. Either rename your local one or take
your home folder off the Python path... at least for long enough
for ez_setup to do its stuff.

TJG
How can do the second solution, (take off the home from Python path)?
 
T

Tim Golden

Nader said:
Tim said:
Nader said:
L.S.,

I have installed locally Python-2.4.4 without any problem. Then I
would install the "ez_setup.py" to be able using of "easy_install"
tool, but I get the next error:

%python ez_setup.py
Traceback (most recent call last):
File "ez_setup.py", line 223, in ?
main(sys.argv[1:])
File "ez_setup.py", line 155, in main
egg = download_setuptools(version, delay=0)
File "ez_setup.py", line 111, in download_setuptools
import urllib2, shutil
File "/usr/people/emami/lib/python2.4/urllib2.py", line 108, in ?
import cookielib
File "/usr/people/emami/lib/python2.4/cookielib.py", line 35, in ?
from calendar import timegm
File "/usr/people/emami/calendar.py", line 23, in ?
import pygtk
ImportError: No module named pygtk

I don't understand what is the problem! Could somebody tell me what I
have to do to solve it?

You have a module called "calendar" in your user directory
/usr/people/emami/calendar.py which is shadowing the stdlib
calendar module -- which doesn't get used much so you've
probably never noticed. Either rename your local one or take
your home folder off the Python path... at least for long enough
for ez_setup to do its stuff.

TJG
How can do the second solution, (take off the home from Python path)?

Depends on your setup. Since you're on *nix, I can't
test whether $HOME is automatically on sys.path (it
isn't on Win32). Are you running *in* /usr/people/emami?
If so, go somewhere else before you run ez_setup. Check
your PYTHONPATH env var; perhaps reset it before
running ez_setup. There are other more obscure possibilities
to do with things set in site.py but they're less likely.

TJG
 
T

Tim Golden

Nader said:
I have a Linux and I don't have any PYTHONPTH variable, because if I run
the next command it returns nothig:

%env | grep -i pythonpath or
%env | grep -i python

I'm no expert here, but I believe that Linux is
case-sensitive, so you'd need to do:

env | grep PYTHONPATH

TJG
 
T

Tim Golden

Nader said:
'grep' with 'i' option can catch both of them. I have done with capital
letters also and the answer stays the same:
%env | grep PYTHONPATH of %env | grep PTYTHON

OK. Keep copying to the list, please. As I said, I'm not
a *nix person (and I'm running here on Windows) so you'll
get a more informed and wider audience from c.l.py.

If there's no PYTHONPATH that means it's just down to
your system setup what goes on the path. Try (from
within the python interpreter):

<code>
import sys
for i in sys.path:
print i

</code>

Do you see your home directory there?

TJG
 
T

Tim Golden

Nader said:
This is the result of the code:
/usr/people/emami/lib/python24.zip
/usr/people/emami/lib/python2.4
/usr/people/emami/lib/python2.4/plat-linux2
/usr/people/emami/lib/python2.4/lib-tk
/usr/people/emami/lib/python2.4/lib-dynload
/usr/people/emami/lib/python2.4/site-packages

(Sigh). Copying back to the list.

So, are you running in /usr/people/emami when
you're call ez_setup?

TJG
 
P

Paul Boddie

OK. Keep copying to the list, please. As I said, I'm not
a *nix person (and I'm running here on Windows) so you'll
get a more informed and wider audience from c.l.py.

Just to clarify one thing, $HOME isn't automatically inserted into
sys.path on UNIX, at least in all versions of Python I've used.
However, the directory where an executed Python program resides may be
used in the process of locating modules: it seems to be inserted
automatically into sys.path as the first element, in fact.

So if calendar.py is in the same directory as ez_setup.py, I would
imagine that any attempt to import the calendar module will result in
the this non-standard calendar.py being found and imported, rather
than the standard library's calendar module. The most appropriate
solution is to put ez_setup.py in other location and then to run it.
For example:

mv ez_setup.py /tmp
python /tmp/ez_setup.py

Putting the non-standard calendar.py in a directory separate from
other programs might be an idea, too.

Paul
 

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
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top