Hi Seb,

IDLE restarts the shell each time you run a script. This is the default behavior in order to have a clean interpreter.

In terms of code design, you could try using "import YOURSCRIPT" in your other scripts and refer to path definitions. For example:

YOURSCRIPT.py:

    path_to_files="/home/user/files/"


ANOTHERSCRIPT.py

    import YOURSCRIPT
    print(YOURSCRIPT.path_to_files)


You can also modify the source code of IDLE itself. Look in ScriptBinding.py for "restart_shell". Commenting it out will disable shell restarts. (If you do this, then the only way to get a shell restart is to close the PyShell window and re-open it.) If you want to improve IDLE, you could submit a patch for making the shell restart an option on the Run menu.

Alternatively, if you want to keep stateful information between script executions, try using the SubCode extension at http://idlex.sourceforge.net and use the "Run All Subcodes" feature. This will run your script without restarting the shell.

- Roger




On 11/21/2011 03:56 AM, Sebastien Beauvois wrote:

Hi,

I just installed the 2.7 Python version on my computer and I have a problem to run my scripts. It seems "Idle" makes a "restart" each time I run a new script in my shell and it occurs issues in my test execution because my first scripts contains all paths definition for other scripts.

How can I remove the "Restart" in my shell (see pic attached)?

I had a look in the option menu but I found nothing to solve it.

Thank you in advance.

Seb!

This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.


_______________________________________________
IDLE-dev mailing list
IDLE-dev@python.org
http://mail.python.org/mailman/listinfo/idle-dev

_______________________________________________
IDLE-dev mailing list
IDLE-dev@python.org
http://mail.python.org/mailman/listinfo/idle-dev

Reply via email to