5300

Why does Python's IDLE crash when I type a parenthesis on Mac?

Question:

Ok, I realize this may be an extremely nuanced question, but it has been bugging me for a while. I like the simple scripting interface of IDLE, but it keeps crashing on me when: (1) I am coding on an external monitor and (2) I type the parenthesis button, "(". IDLE never crashes for me for any other reason than this very specific situation. Strangely, if I have an external monitor connected, but I have the IDLE dev window on my laptop's main screen, I have ZERO problems with crashing. (???) I have lost a substantial amount of code due to this problem.

I am running on Mac OSX Version 10.11.3 and I have a MacBook Pro (Retina, 15-inch, Mid 2015) Any thoughts would be appreciated!

Answer1:

Ok, answering my own question. Per the recomendation of Андрей, I reviewed the notes and comments here: <a href="http://bugs.python.org/issue16177" rel="nofollow">http://bugs.python.org/issue16177</a> I did some experimentation and figured out a work-around to avoid this problem. The problem only occurs when you are coding in an external monitor AND when the "Arrangement" of the external monitor is set as being higher (or elevated) relative to the primary monitor. Specifically, it occurs when the IDLE development window is totally or near-totally in a space on the secondary screen that would be considered "North" of the top edge of the primary screen. Thus, the patch is to reconfigure your "Arrangement" settings on your Mac so that the monitors are systematically aligned in a near-horizontal fashion. This may make things feel less natural, but it will fix the problem. That being said, I have no idea what the root cause of the problem is. I'm just glad to finally have this figured out. Hope this helps at least one other person.

Answer2:

I found a fix! One that doesn't require changing monitor settings.

In IDLE:

<em>Options Menu > Configure Extensions > CallTips > set to FALSE</em>

Then restart.

Took much research to find that super simple solution... the problem is caused not by an error in IDLE but by an error in the mac's Tcl/Tk code when calltips are called in external monitors above the default monitor.

Answer3:

Typing '(' after a function name should bring up a calltip giving the signature of the function if the function is currently known. Functions can be made known by occasionally running your code. We recentlyly discovered that some combinations of Mac OSX or MacOS and tcl/tk require an addition of one line to idlelib/calltip_w.py (3.6+) or idlelib/CallTipWindow.py (3.5-). <a href="https://bugs.python.org/issue34275" rel="nofollow">Issue 34275</a>

self.label.pack() # Line 74 tw.update_idletasks() # ADD THIS LINE! tw.lift()

Without this, the calltip does not appear. I don't know if this also prevents any of the crashes that people have reported. If the above does not work, please remove _idletasks and let me know in a comment.

Recommend

  • Work with git on Windows 7 machine [duplicate]
  • App.config only for my developer machine
  • Make a whole row in a table “link-able”
  • How can I add padding-right to an input type=“number” when aligning right?
  • Storing Images in a mysql database
  • How to get title from class attribute in XPath(Python/scrapy)
  • Managing branches in subversion
  • Why doesn't F# support Edit and Continue? [closed]
  • VBScript - Error 0x80041017 (null)
  • Removing the Edit on Github link when using Read The Docs & Sphinx with ReadTheDocs Theme
  • Angular Databinding doesnt Work
  • What are the use cases of dlopen vs standard dynamic linking?
  • How to model a mixture of finite components from different parametric families with JAGS?
  • Safari PHP form submission -file upload hangs
  • Iterate twice through a DataReader
  • Cordova Apache wrong module path
  • Why does java tzupdater add leap seconds?
  • using System.Speech.Synthesis with Windows10 universal app (XAML-C#)
  • aapt.exe'' finished with non-zero exit value 1
  • Salesforce Different WSDL files and when to use
  • Convert SQLite database to XML
  • where do I find the xml.dom python package for the python-2.6.0-8.9.28 and I have a suse/x86_64 vers
  • Python pickle not one-to-one: different pickles give same object
  • AndEngine Applying Transparancy to AndEngine View
  • Automatically associate new Sonar project with custom quality profile and quality gate
  • Do I need to reset a Perl hash index?
  • Jetty 9 HashLoginService
  • Installing Apache MyFaces 2 on WildFly 8.2.0
  • Use of this Javascript
  • Read a local file using javascript
  • ImageMagick, replace semi-transparent white with opaque white
  • Cannot connect to cassandra from Spark
  • Cross-Platform Protobuf Serialization
  • Alternatives to the OPTIONAL fallback SPARQL pattern?
  • bootstrap to use multiple ng-app
  • How to get icons for entities from eclipse?
  • Turn off referential integrity in Derby? is it possible?
  • How does Linux kernel interrupt the application?
  • JaxB to read class hierarchy
  • git trying to push non-existent file … after clearing cache