Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IDLE - recompile changed code

I can't seem to force IDLE to recompile code. Here's my simple design:

class A and B, B imports A

When I change A, then run B, IDLE doesn't seem to recompile A and run the old version of A.

How can I fix this? :\

like image 247
Jin Avatar asked Dec 31 '25 12:12

Jin


1 Answers

The answer on the python tracker was that someone was starting IDLE with a icon with startup property /usr/bin/idle-python2.5 -n. The key issue is the presence of -n, which says to run user code in the IDLE process. So when B imported A after the first run, A was in sys.modules of the IDLE process. Without -n, IDLE runs user code in the editor (F5) in a new, separate process, where A has to be re-imported from the file. Jin apparently had the same issue.

like image 59
Terry Jan Reedy Avatar answered Jan 02 '26 04:01

Terry Jan Reedy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!