1

I'm running mojave 10.14.2
I typed this into terminal python -V and got
Python 2.7.10

I use 3D software called poser, and I had some amazingly useful scripts for this that i bought. There is one in particular made by D3D (Ralph) who sadly passed away.
The script he made calls for tkinter, but for recent OSs the script fails on my imac pro because there is no tkinter.

If I were to try to load in a more modern version of python eg like 3. something, do you think my scripts that need tkinter possibly work? Esther (who knows nothing about programming)

  • 1
    @benwiggy Are you sure about this? I tried on Mojave, executing import tkinter as tk results in ImportError: No module named tkinter. – nohillside Jan 24 at 11:49
  • 2
    Use a Capital T. Works on Mohave and Mountain Lion. – benwiggy Jan 24 at 11:53
  • @benwiggy Ahh. Python3 isn't that strict :-) Wonder if this is the problem the OP is facing... – nohillside Jan 24 at 11:56
  • Can you edit the question to add the exact error message you are getting? – nohillside Jan 24 at 11:57
  • @nohillside - not strictness but a change in the package name to meet standards. – Mark Jan 24 at 12:11
2

Make sure that the script calls the system python: /usr/bin/python

Make sure that Tkinter is imported as Tkinter (with a Capital T). Using all lower case will fail with an error message.

Tkinter is included with the built-in version of python on MacOS, so there must be some other problem on your Mac if Tkinter is not 'there'.

  • Although note it is buggy python.org/download/mac/tcltk – Mark Jan 24 at 12:12
  • This is the error i get within poser when i try and run the script:- A Python script was trying to use the Tkinter library. Tkinter is not compatible with the Mac OS X version of Poser. If you are a script author, please consider using wxPython instead of Tkinter. – user7030480 Jan 25 at 14:11
  • Even if I knew how to do coding I wouldn't be able to edit the script. I'm not sure it is editable or even if it is legal to decompile someone's script anyway. – user7030480 Jan 25 at 14:13
  • Ah. That puts a different spin on it. There's nothing wrong with the script itself, but Poser is forbidding it from running, for some reason. Are you saying that the same script used to work on the same version of Poser on an earlier MacOS version? – benwiggy Jan 25 at 14:17
  • No I did not use the script in this current version of poser. But all my tkinter scripts stopped working after an OS upgrade for mac - i forget which one and programmers were told they needed to use wxpython and that tkinter would not work anymore. I have not tried the script since those days until now. – user7030480 Feb 3 at 6:07
1

The correct long term solution is to use python 3, however this requires the conversion of python code from version 2 to 3 and this is non trivial.

Another way is to install a version of python 2 that includes Tk. Python can be installed in several ways often by using a package manager like conda, Macports or Homebrew or directly from python.org. Normally for python use I would suggest using conda as it manages the installation and use of third party python packages, however in your case as you are just running scripts it might be easier to just use the python.org on.

The latest version for python 2 is 2.7.15 but check that your $PATH has /usr/local/bin before /usr/bin otherwise you will still have the apple python as you have now.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .