Code Monkey home page Code Monkey logo

Comments (2)

benjaminp avatar benjaminp commented on September 17, 2024

Should be fixed as of pull request #18.

from six.

benjaminp avatar benjaminp commented on September 17, 2024

Original comment by peterjc (Bitbucket: peterjc, GitHub: peterjc):


Another sub-example, Python 2:

from ScrolledText import ScrolledText

And Python 3 or after 2to3,

from tkinter.scrolledtext import ScrolledText

Expected equivalent via six (which fails):

from six.moves.tkinter_scrolledtext import ScrolledText

Workaround (which requires changing all usage of the imported module):

from six.moves import tkinter_scrolledtext

e.g.

$ python
Python 2.7.2 (default, Oct 11 2012, 20:14:37) 
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Tkinter
>>> from ScrolledText import ScrolledText
>>> from six.moves import tkinter_scrolledtext
>>> from six.moves.tkinter_scrolledtext import ScrolledText
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named tkinter_scrolledtext
>>> quit()

and the more confusing error under Python 3,

$ python3
Python 3.3.0 (default, Sep 29 2012, 19:41:44) 
[GCC 4.2.1 Compatible Apple Clang 4.0 ((tags/Apple/clang-421.0.60))] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
>>> from tkinter.scrolledtext import ScrolledText
>>> from six.moves import tkinter_scrolledtext
>>> from six.moves.tkinter_scrolledtext import ScrolledText
Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 1512, in _find_and_load_unlocked
AttributeError: '_MovedItems' object has no attribute '__path__'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'six.moves.tkinter_scrolledtext'; six.moves is not a package
>>> quit()

from six.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.