0

I have 2 scripts

  1. Python automation script where I am integrating IXIA (which is tcl based) script.
  2. One more script in Python again, just to connect to IXIA to login and send traffic on network, which works well.

But the problem I am facing is with integrating the same with my automation script, it displays

No module named Tkinter.

When I tried to solve the issue by googling and searching on other sites I found few solutions telling

  1. to check with Tkinter (Python version <= 3) and Tkinter (python version >3) --> this is not the case

  2. softlinking with the installation directory

  3. LD_LIBRARY_PATH variable--> tried
  4. TIX_LIBRARY variable--> tried

To understand the problem I tried moving the required installation directory (the crude/inappropriate way) to the automation directory it solved one issue of Tkinter and gave further 2 issues as below one by one

a. Traceback (most recent call last):
         File "/share/apps/sts/sts_start.py", line 15, in <module>
           import Tkinter
         File "/share/apps/lib/python/lib-tk/Tkinter.py", line 39, in <module>
           import _tkinter # If this fails your Python may not be configured for Tk
       ImportError: No module named _tkinter
b. Traceback (most recent call last):
     File "/share/apps/sts/sts_start.py", line 15, in <module>
       import Tkinter
         File "/share/apps/lib/python/lib-tk/Tkinter.py", line 39, in <module>
           import _tkinter # If this fails your Python may not be configured for Tk
   ImportError: libTix.so: cannot open shared object file: No such file or directory

These issues were expected as it will give issues with subsequent dependencies.

Directories copied are:

  1. /usr/lib64/python2.6; lib-tk and lib-dynload
  2. /usr/lib64/tcl8.5

into /share/apps/lib/python

Python version:

Python 2.6.6 (r266:84292, Jul 23 2015, 15:22:56)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux2

tcl version:

$ tclsh
% info patchlevel
8.5.7
%

Directory of lib-tk installation:

/usr/lib64/python/lib-tk

automation script library path:

/share/apps/lib/python/
$ls 
arm_avp  common  dvtools  lib-dynload  lib-tk  python2.6  site-packages  sknobs  strega_fe  sts-packages  tcl8.5

pasting my other environment variables below -

$ echo $PATH
/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/java/latest/bin:/opt/pdsh/bin:/opt/rocks/bin:/opt/rocks/sbin:/opt/gridengine/bin/linux-x64:/share/apps/bin:/home/amcclab/bin
$ echo $PYTHONPATH
/share/apps/lib/python/arm_avp:/share/apps/lib/python/common:/share/apps/lib/python/dvtools:/share/apps/lib/python/lib-dynload:/share/apps/lib/python/lib-tk:/share/apps/lib/python/python2.6:/share/apps/lib/python/site-packages:/share/apps/lib/python/sknobs:/share/apps/lib/python/strega_fe:/share/apps/lib/python/sts-packages:/share/apps/lib/python/tcl8.5

Please guide me to get the Tkinter package working with my script.

David Andrei Ned
  • 799
  • 1
  • 11
  • 28
ajinkya
  • 1
  • 1
  • How did you install tkinter? using `yum install tkinter` or just using the 64 bit libraries? to me it looks like the installed lib-tk likes to (relatively) point to tkinter which was not copied and therefor not found. – R4PH43L Mar 15 '16 at 15:14
  • Yes I did use the same command - `Yum install tkinter` – ajinkya Mar 18 '16 at 10:13
  • Yes I did use the same command - `Yum install tkinter` No- the installed tkinter works fine, I want the same installation to work for my automation script, which has its own python-related library and also the environment variables set for it. I can paste my bashrac here to have more details regarding environment variables and paths. – ajinkya Mar 18 '16 at 10:21
  • Not sure if I am getting correctly what you are calling "python-related library and environment" - are you using some venv (Virtual Environment) like anaconda? Have you also installed python-tk? You wrote you copied the lib-tk and tcl libs into your apps-path. Have you already tried installing it directly there? [This question - answered by Simon](http://stackoverflow.com/questions/4783810/install-tkinter-for-python) shows how. Not sure if just copying would be enough for your environmental situtation there. – R4PH43L Mar 18 '16 at 13:43

0 Answers0