[issue24718] Specify interpreter when running in IDLE

2017-06-20 Thread Terry J. Reedy

Terry J. Reedy added the comment:

>From your post, it was unclear to me what you are actually asking for.  From 
>reading the bitbucket thread, it appears that you want something I cannot give 
>you -- a built-in privileged position in IDLE.  However, as I said before, you 
>can write a pgz extension.  An extension can add a menu entry and get a 
>reference to the editor's tk Text widget.  It would be easy to write one that 
>added needed boilerplate at the top and bottom of a file so that it is ready 
>to run with F5.  The top part could end with
# Ignore everything above this line.
and the bottom part start with
# Ignore everything below this line.
With more effort, you could do probably do more to hide the boilerplate, but as 
I explained before, I have no motivation for that.

--
assignee:  -> terry.reedy
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24718] Specify interpreter when running in IDLE

2015-07-31 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I have in mind the idea of enhancing run module options.  In particular, I 
think there should be a Run in console option (python -i -m file.  
However I do not understand exactly what you would want.

I believe you could now write an extension that would add 'pgzrun' to the Run 
menu and define a function bound to that entry that would call subprocess with 
python -m pgzero script.  Error tracebacks (and print() output, but games 
should not do such) would appear in the console menu instead of Idle's Shell.  
You could add '-i' to the invocation for post-mortem investigation.

Idle *simulates* running a file with python -i -m script.  What it actually 
does (on Windows) is pythonw -m .../idlelib/run.py.  The editor contents are 
compiled in the Idle process. The code must be complete at this time.  For 
tracebacks to work properly, it must be the same as displayed in the editor, so 
adding an import line is a bad idea. 

If both the process invocation and compile work, the code object is sent to the 
process and exec'ed in a pseudo-main namespace.  Output to stdout/err is sent 
back to Shell.  The only interpreter option I see here is run a different 
version of python and run.py (not trivial).

The user process should import site.py and if present, sitecustomize  and maybe 
a 'usercustomize'.  I am not familiar with these but you could investigate.

I do not see the point of an absolute zero boilerplate requirement. Kids manage 
with from turtle import * and anyone should be able to deal with from pgz 
import *.  Avoiding even that given people a wrong impression of what a proper 
python file looks like and creates trouble that I see as unnecessary.

Since the solution to your problem seems to be a custom extension, patch, or 
use of the site module, I am inclined to close this.

--
nosy: +terry.reedy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24718
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24718] Specify interpreter when running in IDLE

2015-07-25 Thread Daniel Pope

New submission from Daniel Pope:

I maintain a library called Pygame Zero which allows beginner programmers to 
start writing games without lines of boilerplate importing libraries, creating 
event loops and so on.

To support these features, Pygame Zero provides the 'pgzrun' command:

pgzrun script

(or if you prefer, 'python -m pgzero script')

Any workarounds for this, to make games written with this framework run 
directly in IDLE, would detract from its zero-boilerplate approach.

I believe this is similar to, but different from #5680, which is about 
supplying sys.argv to the running process; this is about switching out 
interpreter entirely.

This issue corresponds to an issue in the Pygame Zero tracker:

https://bitbucket.org/lordmauve/pgzero/issues/23/add-a-way-of-invoking-pgzrun-on-the

--
components: IDLE
messages: 247337
nosy: Daniel Pope
priority: normal
severity: normal
status: open
title: Specify interpreter when running in IDLE
type: enhancement

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24718
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com