Re: Clearing the screen

Discussion in 'Python' started by Nick Coghlan, Dec 25, 2004.

  1. Nick Coghlan

    Nick Coghlan Guest

    Jeff Epler wrote:
    > I don't know about idle, but the "real" python supports the
    > PYTHONSTARTUP environment variable.



    I just tried it - IDLE ignores PYTHONSTARTUP, as does PythonWin (I just started
    using PYTHONSTARTUP to switch the standard prompt from '>>>' to "Py>').

    I believe PYTHONSTARTUP is handled by CPython's main function before it gets to
    the interactive interpreter.

    Cheers,
    Nick.

    --
    Nick Coghlan | | Brisbane, Australia
    ---------------------------------------------------------------
    http://boredomandlaziness.skystorm.net
     
    Nick Coghlan, Dec 25, 2004
    #1
    1. Advertising

  2. Nick Coghlan wrote:
    > Jeff Epler wrote:
    >
    >> I don't know about idle, but the "real" python supports the
    >> PYTHONSTARTUP environment variable.

    >
    > I just tried it - IDLE ignores PYTHONSTARTUP, as does PythonWin (I just
    > started using PYTHONSTARTUP to switch the standard prompt from '>>>' to
    > "Py>').
    >
    > I believe PYTHONSTARTUP is handled by CPython's main function before it
    > gets to the interactive interpreter.
    >
    > Cheers,
    > Nick.
    >

    From the Fine Manual:
    Command line usage
    idle.py [-c command] [-d] [-e] [-s] [-t title] [arg] ...

    -c command run this command
    -d enable debugger
    -e edit mode; arguments are files to be edited
    -s run $IDLESTARTUP or $PYTHONSTARTUP first
    -t title set title of shell window

    On Windows, it is likely to be idle.pyw. So, add a -s to the command
    line used in the shortcut to start Idle.


    --Scott David Daniels
     
    Scott David Daniels, Dec 26, 2004
    #2
    1. Advertising

  3. Scott David Daniels wrote:
    > Nick Coghlan wrote:
    >
    >> Jeff Epler wrote:
    >>
    >>> I don't know about idle, but the "real" python supports the
    >>> PYTHONSTARTUP environment variable.

    >>
    >>
    >> I just tried it - IDLE ignores PYTHONSTARTUP, as does PythonWin (I
    >> just started using PYTHONSTARTUP to switch the standard prompt from
    >> '>>>' to "Py>').
    >>
    >> I believe PYTHONSTARTUP is handled by CPython's main function before
    >> it gets to the interactive interpreter.
    >>
    >> Cheers,
    >> Nick.
    >>

    > From the Fine Manual:
    > Command line usage
    > idle.py [-c command] [-d] [-e] [-s] [-t title] [arg] ...
    >
    > -c command run this command
    > -d enable debugger
    > -e edit mode; arguments are files to be edited
    > -s run $IDLESTARTUP or $PYTHONSTARTUP first
    > -t title set title of shell window
    >
    > On Windows, it is likely to be idle.pyw. So, add a -s to the command
    > line used in the shortcut to start Idle.


    Anyone know if there is a similar option to PythonWin? I looked around
    a bit, but couldn't find one...

    Steve
     
    Steven Bethard, Dec 26, 2004
    #3
  4. Nick Coghlan

    Ishwor Guest

    On Sun, 26 Dec 2004 01:47:42 GMT, Steven Bethard
    <> wrote:
    > Scott David Daniels wrote:
    > > Nick Coghlan wrote:
    > >
    > >> Jeff Epler wrote:
    > >>
    > >>> I don't know about idle, but the "real" python supports the
    > >>> PYTHONSTARTUP environment variable.
    > >>
    > >>
    > >> I just tried it - IDLE ignores PYTHONSTARTUP, as does PythonWin (I
    > >> just started using PYTHONSTARTUP to switch the standard prompt from
    > >> '>>>' to "Py>').
    > >>
    > >> I believe PYTHONSTARTUP is handled by CPython's main function before
    > >> it gets to the interactive interpreter.
    > >>
    > >> Cheers,
    > >> Nick.
    > >>

    > > From the Fine Manual:
    > > Command line usage
    > > idle.py [-c command] [-d] [-e] [-s] [-t title] [arg] ...
    > >
    > > -c command run this command
    > > -d enable debugger
    > > -e edit mode; arguments are files to be edited
    > > -s run $IDLESTARTUP or $PYTHONSTARTUP first
    > > -t title set title of shell window
    > >
    > > On Windows, it is likely to be idle.pyw. So, add a -s to the command
    > > line used in the shortcut to start Idle.

    >
    > Anyone know if there is a similar option to PythonWin? I looked around
    > a bit, but couldn't find one...


    i was just tinkering with it actually. ;-)
    In your command prompt just do
    Pythonwin.exe /run "C:\Python24\file\PyFiles\clear.py"

    or if you hate doing that then just create a batch script (.bat) as such-

    @echo off
    start "C:\Python24\Lib\site-packages\pythonwin\Pythonwin.exe /run
    "C:\Python24\file\PyFiles\clear.py" "

    see the pythonwin reference manual for more option ;)
    >
    > Steve
    > --
    > http://mail.python.org/mailman/listinfo/python-list
    >



    --
    cheers,
    Ishwor Gurung
     
    Ishwor, Dec 26, 2004
    #4
  5. Nick Coghlan

    John Machin Guest

    Ishwor wrote:

    > i was just tinkering with it actually. ;-)
    > In your command prompt just do
    > Pythonwin.exe /run "C:\Python24\file\PyFiles\clear.py"


    It's not a very good idea to store your own scripts in the PythonXY
    directory -- other than tested working modules which you install in
    PythonXY\lib\site-packages.
    E.g. what will you do when Python 2.5 arrives?
     
    John Machin, Dec 26, 2004
    #5
  6. Nick Coghlan

    Steve Holden Guest

    Customizing interpreter behavior [was: Clearing the screen]

    John Machin wrote:

    > Ishwor wrote:
    >
    >
    >>i was just tinkering with it actually. ;-)
    >>In your command prompt just do
    >>Pythonwin.exe /run "C:\Python24\file\PyFiles\clear.py"

    >
    >
    > It's not a very good idea to store your own scripts in the PythonXY
    > directory -- other than tested working modules which you install in
    > PythonXY\lib\site-packages.
    > E.g. what will you do when Python 2.5 arrives?
    >


    As has been recently pointed out in another thread, the interpreter
    (actually, code in the "site" module) searches for a "sitecustomize"
    module when starting up. This is the easiest way to implement required
    startup behavior no matter what environment the interpreter's running
    in. For more information, RTFM concerning the "site" module, whose
    documentation includes the following:

    """After these path manipulations, an attempt is made to import a module
    named sitecustomize, which can perform arbitrary site-specific
    customizations. If this import fails with an ImportError exception, it
    is silently ignored."""

    regards
    Steve
    --
    Steve Holden http://www.holdenweb.com/
    Python Web Programming http://pydish.holdenweb.com/
    Holden Web LLC +1 703 861 4237 +1 800 494 3119
     
    Steve Holden, Dec 27, 2004
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Colin Hemmings

    Clearing the output screen

    Colin Hemmings, Feb 20, 2006, in forum: Java
    Replies:
    3
    Views:
    9,827
    ~Glynne
    Feb 21, 2006
  2. Sebastian Becker

    Clearing Screen

    Sebastian Becker, Jan 12, 2005, in forum: C++
    Replies:
    2
    Views:
    502
    Mike Wahler
    Jan 12, 2005
  3. Miki Tebeka

    Clearing IDLE's screen?

    Miki Tebeka, Feb 8, 2004, in forum: Python
    Replies:
    3
    Views:
    781
    Scott David Daniels
    Feb 9, 2004
  4. Ishwor

    Clearing the screen

    Ishwor, Dec 24, 2004, in forum: Python
    Replies:
    4
    Views:
    356
    Artur M. Piwko
    Jan 1, 2005
  5. Kaizer
    Replies:
    3
    Views:
    268
    Kaizer
    Dec 10, 2005
Loading...

Share This Page