Marek Szuba wrote:
> Is there any way of detecting in a script whether the interpreter
> session running it has been launched with the -i option? My Google fu
> has failed me on this subject... Thanks in advance.
There is no direct way to detect the interactive flag. However sys.ps1
and sys.ps2 ar
On Mon, Apr 13, 2009 at 6:10 PM, Static Vagabond wrote:
> Chris Rebert wrote:
>>>
>>> Marek Szuba wrote:
On 2009-04-13, Chris Rebert wrote:
> The sys.flags.interactive bool.
>
> Details: http://docs.python.org/library/sys.html#sys.flags
Hmm, "New in version 2.
Chris Rebert wrote:
Marek Szuba wrote:
On 2009-04-13, Chris Rebert wrote:
The sys.flags.interactive bool.
Details: http://docs.python.org/library/sys.html#sys.flags
Hmm, "New in version 2.6"... Are you aware of any way of extracting
this information in older versions of Python? My code need
> Marek Szuba wrote:
>>
>> On 2009-04-13, Chris Rebert wrote:
>>
>>> The sys.flags.interactive bool.
>>>
>>> Details: http://docs.python.org/library/sys.html#sys.flags
>>
>> Hmm, "New in version 2.6"... Are you aware of any way of extracting
>> this information in older versions of Python? My code
I think getopt will help you achieve what you need.
http://docs.python.org/library/getopt.html
Here's a quick example:
import getopt
import sys
try:
opts, args = getopt.getopt(sys.argv[1:], "-i:vo:vhb?")
except getopt.GetoptError, err:
helpCommand() # defined elsewhere.
sys.exit()
On 2009-04-13, Chris Rebert wrote:
> The sys.flags.interactive bool.
>
> Details: http://docs.python.org/library/sys.html#sys.flags
Hmm, "New in version 2.6"... Are you aware of any way of extracting
this information in older versions of Python? My code needs to be
2.3-compatible.
--
MS
--
http
On Mon, Apr 13, 2009 at 12:09 PM, Marek Szuba wrote:
> Hello there,
>
> Is there any way of detecting in a script whether the interpreter
> session running it has been launched with the -i option? My Google fu
> has failed me on this subject... Thanks in advance.
The sys.flags.interactive bool.