Problem with Python and _tkinter on SunOS system

Discussion in 'Python' started by gaool@caramail.com, Sep 15, 2004.

  1. Guest

    Hello,

    I try to launch a Python script on SunOS system but I have this error:

    """Traceback (most recent call last):
    File "ihm1_1.py", line 3, in ?
    from Tkinter import *
    File "/opt/sfw/lib/python2.3/lib-tk/Tkinter.py", line 38, in ?
    import _tkinter # If this fails your Python may not be
    configured for Tk
    ImportError: ld.so.1: python: fatal: relocation error: file
    /usr/local/lib/libtk8.4.so: symbol __eprintf: referenced
    symbol not found"""

    At the beginning, some people told me that it was due to a
    different GCC version used for Python compilation and Tcl/Tk
    compilation (because of "__eprintf" error).

    =>But the GGC version was the same for the Python and Tcl/Tk
    compilation on my system: GCC 3.3.2.

    Then, I tried to find a solution and this is what i've found
    on the Python web site:
    """
    Step 1 - can _tkinter be imported?
    Try the following command at the Python prompt:
    >>> import _tkinter # with underscore, and lowercase 't'

    * If it works, skip to the next step.
    * If it fails with "No module named _tkinter", your Python
    configuration needs to be modified to include this module
    (which is an extension module implemented in C). Edit
    Modules/Setup (read the instructions at the top, search for
    _tkinter, read more instructions there, and follow the
    instructions) and rebuild and reinstall. Make sure to
    enable the _tkinter module as well as the TKPATH variable
    definition.
    * If it fails with an error from the dynamic linker, see
    above (for Unix, check for a header/library file mismatch;
    for Windows, check that the TCL/TK DLLs can be found)."""

    But I don't understand what "Edit Modules/Setup" means? Where is it ?
    What is TKPATH? How can I modify it?

    Do you think my problem comes from that "Edit Modules/Setup" ? Or do you think that there is something else wrong ?

    thanks.
     
    , Sep 15, 2004
    #1
    1. Advertising

  2. Eric Brunel Guest

    wrote:
    > Hello,
    >
    > I try to launch a Python script on SunOS system but I have this error:
    >
    > """Traceback (most recent call last):
    > File "ihm1_1.py", line 3, in ?
    > from Tkinter import *
    > File "/opt/sfw/lib/python2.3/lib-tk/Tkinter.py", line 38, in ?
    > import _tkinter # If this fails your Python may not be
    > configured for Tk
    > ImportError: ld.so.1: python: fatal: relocation error: file
    > /usr/local/lib/libtk8.4.so: symbol __eprintf: referenced
    > symbol not found"""


    Does tcl/tk work? I.e., if you run wish or wish8.4, does it work? It seems that
    it can be a problem with a shared object used by libtk8.4.so that cannot be found.

    [snip]
    > Then, I tried to find a solution and this is what i've found
    > on the Python web site:
    > """
    > Step 1 - can _tkinter be imported?
    > Try the following command at the Python prompt:
    > >>> import _tkinter # with underscore, and lowercase 't'

    > * If it works, skip to the next step.
    > * If it fails with "No module named _tkinter", your Python
    > configuration needs to be modified to include this module
    > (which is an extension module implemented in C). Edit
    > Modules/Setup (read the instructions at the top, search for
    > _tkinter, read more instructions there, and follow the
    > instructions) and rebuild and reinstall. Make sure to
    > enable the _tkinter module as well as the TKPATH variable
    > definition.
    > * If it fails with an error from the dynamic linker, see
    > above (for Unix, check for a header/library file mismatch;
    > for Windows, check that the TCL/TK DLLs can be found)."""
    >
    > But I don't understand what "Edit Modules/Setup" means? Where is it ?
    > What is TKPATH? How can I modify it?


    You didn't compile your Python interpreter yourself, did you? The Setup file is
    in Python's source directory under the Modules directory. Open this file in a
    text editor and look for a line containing _tkinter. Read the comments after
    this line; they should be self-explanatory. If you modify the file, you'll have
    to re-compile your interpreter.

    > Do you think my problem comes from that "Edit Modules/Setup" ? Or do you think that there is something else wrong ?


    Maybe, maybe not... Apparently, the tk library is found, so Python seems to be
    correctly configured. Maybe the problem is in the tcl/tk installation, but you
    should see that by running wish.

    HTH
    --
    - Eric Brunel <eric (underscore) brunel (at) despammed (dot) com> -
    PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com
     
    Eric Brunel, Sep 15, 2004
    #2
    1. Advertising

  3. gaool Guest

    Hello,

    Thanks for your answer. I tried to run wish and wish8.4 and it both
    works! (a little screen appears on the screen). So, apparently Tcl/Tk
    works?!

    It's right that I didn't compile Python myself because I'm in training
    period in a big company and I use SunOS from the network. But the
    Network administrator doesn't know exactly why Python doesn't run on
    SunOS, so I try to find a solution by my side...

    So, I will told him to look at the Setup file and to do the right
    modifications.

    Thanks.


    Eric Brunel <> wrote in message news:<ci9l7j$f6o$>...
    > wrote:
    > > Hello,
    > >
    > > I try to launch a Python script on SunOS system but I have this error:
    > >
    > > """Traceback (most recent call last):
    > > File "ihm1_1.py", line 3, in ?
    > > from Tkinter import *
    > > File "/opt/sfw/lib/python2.3/lib-tk/Tkinter.py", line 38, in ?
    > > import _tkinter # If this fails your Python may not be
    > > configured for Tk
    > > ImportError: ld.so.1: python: fatal: relocation error: file
    > > /usr/local/lib/libtk8.4.so: symbol __eprintf: referenced
    > > symbol not found"""

    >
    > Does tcl/tk work? I.e., if you run wish or wish8.4, does it work? It seems that
    > it can be a problem with a shared object used by libtk8.4.so that cannot be found.
    >
    > [snip]
    > > Then, I tried to find a solution and this is what i've found
    > > on the Python web site:
    > > """
    > > Step 1 - can _tkinter be imported?
    > > Try the following command at the Python prompt:
    > > >>> import _tkinter # with underscore, and lowercase 't'

    > > * If it works, skip to the next step.
    > > * If it fails with "No module named _tkinter", your Python
    > > configuration needs to be modified to include this module
    > > (which is an extension module implemented in C). Edit
    > > Modules/Setup (read the instructions at the top, search for
    > > _tkinter, read more instructions there, and follow the
    > > instructions) and rebuild and reinstall. Make sure to
    > > enable the _tkinter module as well as the TKPATH variable
    > > definition.
    > > * If it fails with an error from the dynamic linker, see
    > > above (for Unix, check for a header/library file mismatch;
    > > for Windows, check that the TCL/TK DLLs can be found)."""
    > >
    > > But I don't understand what "Edit Modules/Setup" means? Where is it ?
    > > What is TKPATH? How can I modify it?

    >
    > You didn't compile your Python interpreter yourself, did you? The Setup file is
    > in Python's source directory under the Modules directory. Open this file in a
    > text editor and look for a line containing _tkinter. Read the comments after
    > this line; they should be self-explanatory. If you modify the file, you'll have
    > to re-compile your interpreter.
    >
    > > Do you think my problem comes from that "Edit Modules/Setup" ? Or do you think that there is something else wrong ?

    >
    > Maybe, maybe not... Apparently, the tk library is found, so Python seems to be
    > correctly configured. Maybe the problem is in the tcl/tk installation, but you
    > should see that by running wish.
    >
    > HTH
     
    gaool, Sep 16, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Berthold =?iso-8859-15?q?H=F6llmann?=

    compiling _tkinter.so (2.3) on SunOS 5.8

    Berthold =?iso-8859-15?q?H=F6llmann?=, Aug 26, 2003, in forum: Python
    Replies:
    0
    Views:
    366
    Berthold =?iso-8859-15?q?H=F6llmann?=
    Aug 26, 2003
  2. Sorin Schwimmer
    Replies:
    1
    Views:
    343
    =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
    Jan 11, 2007
  3. wyleu
    Replies:
    9
    Views:
    417
    =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
    Nov 1, 2007
  4. jgelfand
    Replies:
    5
    Views:
    604
    Diez B. Roggisch
    Mar 26, 2008
  5. galevsky

    Trouble with system() on SunOS

    galevsky, May 16, 2007, in forum: Ruby
    Replies:
    2
    Views:
    301
    Robert Klemme
    May 31, 2007
Loading...

Share This Page