System bell

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Baza

    #1

    System bell

    Am I right in thinking that >>>print "\a" should sound the system, 'bell'?

    B
    --
    Computer says, 'no'


  • Matt

    #2
    Re: System bell

    Try:
    import os
    os.system('\a')

    Comment

    • Trent Mick

      #3
      Re: System bell

      [Baza wrote][color=blue]
      > Am I right in thinking that >>>print "\a" should sound the system, 'bell'?[/color]

      It works on the shell on Windows for me (WinXP).

      Trent

      --
      Trent Mick
      TrentM@ActiveSt ate.com

      Comment

      • Mr6

        #4
        Re: System bell

        Matt wrote:[color=blue]
        > Try:
        > import os
        > os.system('\a')
        >[/color]

        Ta, that's got it.

        B

        Comment

        • Trent Mick

          #5
          Re: System bell

          [Mr6 wrote][color=blue]
          > Matt wrote:[color=green]
          > >Try:
          > >import os
          > >os.system('\a' )
          > >[/color]
          >
          > Ta, that's got it.[/color]

          I suspect that you are misinterpreting failure as success here. This is
          probably only resulting in a bell from the shell when it complains that
          it doesn't know of any command called "\a" to run.

          Trent

          --
          Trent Mick
          TrentM@ActiveSt ate.com

          Comment

          • Daniel Bickett

            #6
            Re: System bell

            Trent Mick wrote:[color=blue]
            > I suspect that you are misinterpreting failure as success here. This is
            > probably only resulting in a bell from the shell when it complains that
            > it doesn't know of any command called "\a" to run.[/color]

            Contrarily, \a is in fact the escape sequence for, as the OP put it,
            the system "bell" . I can only speak as a Windows user however; I'm
            unaware of the prevalence of this feature across operating systems.

            --
            Daniel Bickett
            dbickett at gmail.com

            Comment

            • Steve Holden

              #7
              Re: System bell

              Trent Mick wrote:[color=blue]
              > [Baza wrote]
              >[color=green]
              >>Am I right in thinking that >>>print "\a" should sound the system, 'bell'?[/color]
              >
              >
              > It works on the shell on Windows for me (WinXP).
              >
              > Trent
              >[/color]
              Interesting. From a Cygwin bash shell I got an elegant little dingish
              sort of a beep (my volume control was set kind of low). I then ran the
              same code in a Windows shell and nearly deafened myself. It appears that
              the volume control doesn't affect the Windows XP commans shell beep -
              even muting the Windows audio output doesn't stop it (though it does
              stop the Cygwin beep). This could cause heart attacks!

              regards
              Steve
              --
              Steve Holden +1 703 861 4237 +1 800 494 3119
              Holden Web LLC http://www.holdenweb.com/
              Python Web Programming http://pydish.holdenweb.com/

              Comment

              • Bengt Richter

                #8
                Re: System bell

                On Fri, 01 Apr 2005 02:06:07 -0500, Steve Holden <steve@holdenwe b.com> wrote:
                [color=blue]
                >Trent Mick wrote:[color=green]
                >> [Baza wrote]
                >>[color=darkred]
                >>>Am I right in thinking that >>>print "\a" should sound the system, 'bell'?[/color]
                >>
                >>
                >> It works on the shell on Windows for me (WinXP).
                >>
                >> Trent
                >>[/color]
                >Interesting. From a Cygwin bash shell I got an elegant little dingish
                >sort of a beep (my volume control was set kind of low). I then ran the
                >same code in a Windows shell and nearly deafened myself. It appears that
                >the volume control doesn't affect the Windows XP commans shell beep -
                >even muting the Windows audio output doesn't stop it (though it does
                >stop the Cygwin beep). This could cause heart attacks!
                >[/color]
                Another couple of data points:

                Running python 2.3/MSVC6 or python 2.4/MinGW in an NT4 console window,
                print '\a' beeps via the PC internal speaker (like winsound.Beep).

                Running the bash shell of msys, echo -e '\a' also beeps via the PC speaker.
                These are not affected by any volume control that I know of.

                But running py2.3 idle, print '\a' displays a square empty box (which I
                take to be the symbol for "unprintabl e" characters). That seems like an
                oversight in terminal emulation.

                Regards,
                Bengt Richter

                Comment

                • Matt

                  #9
                  Re: System bell

                  Serves me right for blindlyrunning things from IDLE.

                  This does work (tested on WinXP only):
                  import os
                  os.system('echo \a')

                  Comment

                  • Mr6

                    #10
                    Re: System bell

                    Bengt Richter wrote:[color=blue]
                    > On Fri, 01 Apr 2005 02:06:07 -0500, Steve Holden <steve@holdenwe b.com> wrote:
                    >
                    >[color=green]
                    >>Trent Mick wrote:
                    >>[color=darkred]
                    >>>[Baza wrote]
                    >>>
                    >>>
                    >>>>Am I right in thinking that >>>print "\a" should sound the system, 'bell'?
                    >>>
                    >>>
                    >>>It works on the shell on Windows for me (WinXP).
                    >>>
                    >>>Trent
                    >>>[/color]
                    >>
                    >>Interesting . From a Cygwin bash shell I got an elegant little dingish
                    >>sort of a beep (my volume control was set kind of low). I then ran the
                    >>same code in a Windows shell and nearly deafened myself. It appears that
                    >>the volume control doesn't affect the Windows XP commans shell beep -
                    >>even muting the Windows audio output doesn't stop it (though it does
                    >>stop the Cygwin beep). This could cause heart attacks!
                    >>[/color]
                    >
                    >[/color]

                    It's a weird thing. But if I run print "\a" from idle it does not work.
                    But if I save as a file, say, sound.py. Then run that with python
                    sound.py it does.

                    Why is that?

                    B

                    Comment

                    Working...