idle-ide

wx 'easy gui' library; how do I keep this code from crashing IDLE & Other python IDEs?

When I run this code in IDLE, it crashes. However, if I run it outside of IDLE it works just fine. There are a couple of Python IDEs that are written in python that suffer the same problem, but if I use an IDE/editor that's not based on it, those run fine as well. Is there any way of modifying this code so it doesn't muck up IDLE & Fr...

Python: Why is IDLE so slow?

Hi, IDLE is my favorite Python editor. It offers very nice and intuitive Python shell which is extremely useful for unit-testing and debugging, and a neat debugger. However, code executed under IDLE is insanely slow. By insanely I mean 3 orders of magnitude slow: bash time echo "for i in range(10000): print 'x'," | python Takes 0.0...

Reload Method or Object in IDLE

when using idle, I know you can reload a module if it's changed like this: import foo reload(foo) if I only import part of a module, is there a way to reload it in a similar matter? from foo import bar ...

starting Python IDLE from command line to edit scripts

I am working on a project which has about 15 files that I edit often. So in the past, when I start up IDLE, I open those 15 files for editing individually. I simply wonder if there is a way to automate this, via a .bat file or something. I'm not too good with command line, but I did a bit of research. I came across this page: http://doc...

How can I interact with rather long python scripts?

I love the IDLE. However, sometimes I have 100-200 line scripts and I want to sort of interactively debug/play with say, functions defined in foo.py instead of just calling python foo.py. Is there a way I can trigger IDLE in the context of my foo.py? ...

Using IDLE to run Python PyUnit unit tests

Is there a way, within IDLE, to run the PyUnit (unittest module) unit tests directly? I ask because I have a short test module and when I run it with python mymodule.py from the Cygwin shell I get all tests passed, but when I use Run->Run Module from IDLE the tests pass but then I get an exception (SystemExit: False). For example, here...

How to stop Python program execution in IDLE

I have a python script that uses plt.show() as it's last instruction. When it runs, IDLE just hangs after the last instruction. I get the image but I don't get the prompt back. On other scripts I typically use ctrl-c to break the program (sometimes doesn't work immediately) but how do I get the prompt back with the plt.show()? Ctrl-c do...

write in file is not complete without quitting the IDLE(Python GUI)

I want to write something in a file. for example, fo=open('C:\\Python\\readline_test.txt','a') for i in range(3): st='abc'+'\n' fo.write(st) fo.close then I open this python file in IDLE, and click "Run Module". There is no error message but I find the writing is not complete if I didn't quit IDLE. How can I complete the file writin...

printing the instance in Python

Hello! With this code: class Complex: def __init__(self, realpart, imagpart): self.real = realpart self.imag = imagpart print self.real, self.imag I get this output: >>> Complex(3,2) 3 2 <__main__.Complex instance at 0x01412210> But why does he print the last line? ...

Python IDLE freezes

This is absolutely frustrating, but I am not sure if the following is an issue only on my machine or with IDLE in general. When attempting to print a long list in the shell, and that could happen by accident while debugging, the program crushes and you have to restart it manually. Even worse, if you have a few editor windows open, it a...

Python: Networked IDLE/Redo IDLE front-end while using the same back-end?

Is there any existing web app that lets multiple users work with an interactive IDLE type session at once? Something like: IDLE 2.6.4 Morgan: >>> letters = list("abcdefg") Morgan: >>> # now, how would you iterate over letters? Jack: >>> for char in letters: print "char %s" % char char a char b char c char d char e char f char g M...

Python IDLE: Run main?

I'm in IDLE: >>> import mymodule >>> # ??? After importing a module with: if __name__ == '__main__': doStuff() How do I actually call main from IDLE? ...

Python: How to use code.InteractiveConsole?

I'm trying to use InteractiveConsole to create a new front-end for a Python interpreter. These code fragments are from me playing around with InteractiveConsole in IDLE: >>> ses = code.InteractiveConsole() >>> ses.runsource("def foo():") True >>> ses.runsource(" return 2") File "<input>", line 1 SyntaxError: 'return' outside functi...

Python - Code snippet not working on Python 2.5.6, using IDLE

Hello, everyone I am using a piece of self-modifying code for a college project. Here it is: import datetime import inspect import re import sys def main(): # print the time it is last run lastrun = 'Mon Jun 8 16:31:27 2009' print "This program was last run at ", print lastrun # read in the source code of itsel...

in Python's shell (IDLE), how come need to press up arrow key to exactly that last command line to be able to copy it?

On bash or Window's Command Prompt, we can press the up arrow on keyboard to get the last command, and edit it, and press ENTER again to see the result. But in Python's IDLE 2.6.5 or 3.1.2, it seems if our statement prints out 25 lines, we need to press the up arrow 25 times to that last command, and press ENTER for it to be copied? Or...

In the python IDLE IDE, how do I set a breakpoint in a module other than the one I am running?

If I edit two modules, eggs and ham, and module eggs imports ham, how do I run module eggs such that IDLE stops at breakpoints set in ham? So far, I have only been able to get IDLE to recognize breakpoints set in the module actually being run, not those being imported. ...

What code can I use to check if Python is running in IDLE?

Just as the title says. I want to write a script that behaves differently depending on whether it's running inside a console window or in IDLE. Is there an object that exists only when running in IDLE that I can check for? An environment variable? I'm using Python 2.6.5 and 2.7 on Windows. Edit: The answers given so far work. But I'm ...

IPython GUI (like IDLE)

Is there a GUI for IPython that allows me to open/run/edit Python files? My way of working in IDLE is to have two windows open: the shell and a .py file. I edit the .py file, run it, and interact with the results in the shell. Is it possible to use IPython like this? Or is there an alternative way of working? ...