command line or idle?

S

sjf

Is it possible to distinguish if script is running on python command line
(python.exe) or IDLE?
 
B

Bob Gailer

Is it possible to distinguish if script is running on python command line
(python.exe) or IDLE?

search archive; several threads on this recently.


Bob Gailer
(e-mail address removed)
303 442 2625
 
A

Alex Martelli

sjf said:
Is it possible to distinguish if script is running on python command line
(python.exe) or IDLE?

Not in entirely reliable way, but there are many hints you can generally
rely on. For example, in the IDLE "Python Shell" sys.stdout is an
instance of idlelib.rpc.RPCProxy (in IDLE 1.0) -- that MIGHT happen
even "on python command line", of course, but it is not very likely to.


Alex
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top