This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Tkinter is not working with Py_SetPath
Type: compile error Stage: resolved
Components: Interpreter Core, Tkinter Versions: Python 3.3
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Debarshi.Goswami, iritkatriel
Priority: normal Keywords:

Created on 2013-11-14 11:12 by Debarshi.Goswami, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (4)
msg202825 - (view) Author: Debarshi Goswami (Debarshi.Goswami) Date: 2013-11-14 11:12
Tkinter is not working when I set PYTHONPATH using Py_SetPath before Initialization in an application embedding Python interpreter.

Any call to Py_SetPath is screwing up Tkinter with an error traceback -
-----------------------------------------------------
'Line 1789: Traceback (most recent call last):
  File "TestTK.py", line 33, in <module>
  File "C:\Python33\Lib\tkinter\__init__.py", line 1789, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: Can't find a usable init.tcl in the following directories: 
    C:/Python33/lib/tcl8.5 .... and so on

This probably means that Tcl wasn't installed properly. 
-------------------------------------------------------------
But if set the 2 environment variable it works fine
set TCL_LIBRARY=C:\Python33\tcl\tcl8.5\
set TK_LIBRARY=C:\tcl\tk8.5\

If Py_SetPath is not called tkinter works well and tkwindow can be launched.

I am using Windows7 64 and Python 3.3.2
msg202827 - (view) Author: Debarshi Goswami (Debarshi.Goswami) Date: 2013-11-14 11:23
Is there any way to run Tkinter adding some changes from interpreter?
msg203248 - (view) Author: Debarshi Goswami (Debarshi.Goswami) Date: 2013-11-18 05:27
Anyone tried this issue?
msg399173 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2021-08-07 11:01
This is an old issue and I don't know if it's still relevant. The main problem with this issue is that there isn't enough information to understand what happened.

What did you set the path to with Py_SetPath?

The error message says it could not find in "C:/Python33/lib/tcl8.5 .... and so on"

and then you say it works when you set the path in the env to something else:

"set TCL_LIBRARY=C:\Python33\tcl\tcl8.5\"


If you are still having problems with this in a current python version (>= 3.9), please create a new issue with full information on what you did in the program that didn't work.
History
Date User Action Args
2022-04-11 14:57:53adminsetgithub: 63781
2021-08-07 11:01:30iritkatrielsetstatus: open -> closed

nosy: + iritkatriel
messages: + msg399173

resolution: not a bug
stage: resolved
2013-11-18 05:27:18Debarshi.Goswamisetmessages: + msg203248
2013-11-14 11:23:48Debarshi.Goswamisetmessages: + msg202827
2013-11-14 11:13:52Debarshi.Goswamisettype: compile error
components: + Interpreter Core
2013-11-14 11:12:35Debarshi.Goswamicreate