Calebe
Calebe

Reputation: 817

Python IDLE not accepting quotes

Disclaimer: I'm a noob.

I've installed Python 3.2 (r32:88452) and ActiveTcl 8.5.9.2 (build 294317) on my OSX 10.6. Both installed without any errors, and I've already managed to run a .PY through Terminal. It runs okay.

I run IDLE and it doesn't show any errors. But whenever I press the quote key ('), nothing happens. The same with [shift] pressed ("). The characters just don't register. The same happens with the 'backtick'/tilde key, [shift] pressed or otherwise.

I'm using a U.S. International keyboard layout.

I've tried opening the Keyboard Viewer. Both keys, single quote and 'backtick', are orange-colored. (I had never noticed that until now.) In any other application, whenever they're clicked, the corresponding character is input -- but nothing happens from within the Python IDLE.

Any ideas on what might be happening?

Additional information: Python interpreter in interactive mode (running it from Terminal) registers both keys just fine. Also, if I try and change the keyboard layout to plain "U.S.", even IDLE registers the keys; but this tastes more like a workaround and I'd like to hear your opinions.

Upvotes: 1

Views: 4836

Answers (2)

Ned Deily
Ned Deily

Reputation: 85095

IDLE uses Tkinter from the Python standard library to supply GUI functionality. Tkinter is an interface to the multi-platform Tk graphical interface, part of Tcl/Tk. Unfortunately, Aqua Tk on OS X does not currently support all of the standard text processing features on OS X.

This particular problem appears to be a variation of a known bug in the Cocoa Aqua Tk. On a normal Apple U.S. keyboard, you use option U + <vowel> to form a diaeresis (for example, ä). It looks like on the US International keyboard, the ' key is used instead of the missing option u. There is a patch in the most recent ActiveState Tk 8.5 versions (including the one you have installed) that prevents Tk from crashing in this case. You can see how it used to "work" by launching the Apple-supplied IDLE 2.6 included with Mac OS X 10.6 (/usr/bin/idle2.6). Try typing ' (with the International keyboard setting) or option U (with the US keyboard setting) there! The patched version simply ignores this case, rather than crashing.

Your best bet is to stick to a US or US Extended keyboard input method.

Upvotes: 3

Senthil Kumaran
Senthil Kumaran

Reputation: 56941

Changing to "plain US" is not a workaround but a solution for you, unless you really want to stick with U.S. International layout for some reason. Here are some guidelines on US International Layout.

Upvotes: 0

Related Questions