This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients lordmauve, terry.reedy
Date 2015-07-31.21:57:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1438379877.53.0.0980986840255.issue24718@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2015-07-31 21:57:57terry.reedysetrecipients: + terry.reedy, lordmauve
2015-07-31 21:57:57terry.reedysetmessageid: <1438379877.53.0.0980986840255.issue24718@psf.upfronthosting.co.za>
2015-07-31 21:57:57terry.reedylinkissue24718 messages
2015-07-31 21:57:57terry.reedycreate