Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't import tkinter in Python 2.7 #262

Closed
Marrin opened this issue Jan 14, 2017 · 5 comments
Closed

Can't import tkinter in Python 2.7 #262

Marrin opened this issue Jan 14, 2017 · 5 comments

Comments

@Marrin
Copy link

Marrin commented Jan 14, 2017

I get an error when trying to import tkinter:

Traceback (most recent call last):
  File "forum4.py", line 2, in <module>
    from tkinter import *
  File "/usr/local/lib/python2.7/dist-packages/tkinter/__init__.py", line 6, in <module>
    from Tkinter import (_cnfmerge, _default_root, _flatten, _join, _setit,
ImportError: cannot import name _join

The import of _join was added as fix for #233 and also includes _splitdict, and _stringify which don't exist in my Python 2.7s Tkinter module. The perils of implementation details I guess.

@DaveyBiggers
Copy link

I'm also having this problem on Ubuntu 14.04 and Debian 7 - _splitdict seems to have been introduced around Python 2.7.9; it doesn't exist in 2.7.6, for example, which is the default system python for Ubuntu 14.04.

@sebfio
Copy link

sebfio commented Dec 5, 2017

This error goes away after capitalizing tkinter's import. Change 'tkinter' to 'Tkinter' and it'll hopefully go away!

(I saw this come up on my 14.04 machine)

@Marrin
Copy link
Author

Marrin commented Jul 12, 2018

@sebfio That defeats the point of using future to import the old Python 2 module that is renamed and changed in Python 3, doesn't it?

@mpurg
Copy link
Contributor

mpurg commented Sep 24, 2018

I noticed the same issue as @DaveyBiggers with Ubuntu 14.04.5 LTS, Python 2.7.6, future 0.16.0

Traceback (most recent call last):
  File "file.py", line 42, in <module>
    import tkinter
  File "/home/asd/.virtualenvs/asd/local/lib/python2.7/site-packages/tkinter/__init__.py", line 6, in <module>
    from Tkinter import (_cnfmerge, _default_root, _flatten, _join, _setit,
ImportError: cannot import name _splitdict

I created a pull request with a simple fix.

jmadler added a commit that referenced this issue Oct 12, 2018
Fix for issue #262 (non-existing tkinter imports in older py27 versions)
@jmadler
Copy link
Contributor

jmadler commented May 6, 2019

Resolved by #379

@jmadler jmadler closed this as completed May 6, 2019
@jmadler jmadler removed the 0.18 label May 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants