ez_setup.py

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nader Emami

    #1

    ez_setup.py

    L.S.,

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

    %python ez_setup.py
    Traceback (most recent call last):
    File "ez_setup.p y", line 223, in ?
    main(sys.argv[1:])
    File "ez_setup.p y", line 155, in main
    egg = download_setupt ools(version, delay=0)
    File "ez_setup.p y", line 111, in download_setupt ools
    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
  • Tim Golden

    #2
    Re: ez_setup.py

    Nader Emami wrote:
    L.S.,
    >
    I have installed locally Python-2.4.4 without any problem. Then I would
    install the "ez_setup.p y" to be able using of "easy_insta ll" tool, but I
    get the next error:
    >
    %python ez_setup.py
    Traceback (most recent call last):
    File "ez_setup.p y", line 223, in ?
    main(sys.argv[1:])
    File "ez_setup.p y", line 155, in main
    egg = download_setupt ools(version, delay=0)
    File "ez_setup.p y", line 111, in download_setupt ools
    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

    Comment

    • Nader Emami

      #3
      Re: ez_setup.py

      Tim Golden wrote:
      Nader Emami wrote:
      >L.S.,
      >>
      >I have installed locally Python-2.4.4 without any problem. Then I
      >would install the "ez_setup.p y" to be able using of "easy_insta ll"
      >tool, but I get the next error:
      >>
      >%python ez_setup.py
      >Traceback (most recent call last):
      > File "ez_setup.p y", line 223, in ?
      > main(sys.argv[1:])
      > File "ez_setup.p y", line 155, in main
      > egg = download_setupt ools(version, delay=0)
      > File "ez_setup.p y", line 111, in download_setupt ools
      > 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)?

      Comment

      • Tim Golden

        #4
        Re: ez_setup.py

        Nader Emami wrote:
        Tim Golden wrote:
        >Nader Emami wrote:
        >>L.S.,
        >>>
        >>I have installed locally Python-2.4.4 without any problem. Then I
        >>would install the "ez_setup.p y" to be able using of "easy_insta ll"
        >>tool, but I get the next error:
        >>>
        >>%python ez_setup.py
        >>Traceback (most recent call last):
        >> File "ez_setup.p y", line 223, in ?
        >> main(sys.argv[1:])
        >> File "ez_setup.p y", line 155, in main
        >> egg = download_setupt ools(version, delay=0)
        >> File "ez_setup.p y", line 111, in download_setupt ools
        >> 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

        Comment

        • Tim Golden

          #5
          Re: ez_setup.py

          Nader Emami wrote:
          >>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
          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

          Comment

          • Tim Golden

            #6
            Re: ez_setup.py

            Nader Emami wrote:
            Tim Golden wrote:
            >Nader Emami wrote:
            >>
            >>>>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
            >>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
            '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

            Comment

            • Tim Golden

              #7
              Re: ez_setup.py

              Nader Emami wrote:
              Tim Golden wrote:
              >Nader Emami wrote:
              >>Tim Golden wrote:
              >>>Nader Emami wrote:
              >>>>
              >>>>>>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
              >>>>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
              >>'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
              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

              Comment

              • Paul Boddie

                #8
                Re: ez_setup.py

                On 26 Feb, 17:36, Tim Golden <m...@timgolden .me.ukwrote:
                >
                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

                Comment

                Working...