An interesting question about "print '\a'"

Discussion in 'Python' started by Anthony Liu, Oct 24, 2005.

  1. Anthony Liu

    Anthony Liu Guest

    We know that if we do

    print '\a'

    the bell will sound.

    Now, why do I hear the sound on my local machine when
    I run a python script on a remote host?

    I understand if I hear it when I do

    print '\a'

    on my local machine.

    Does the command get sent back to the client machine?

    Thanks.

    __________________________________________________
    Do You Yahoo!?
    Tired of spam? Yahoo! Mail has the best spam protection around
    http://mail.yahoo.com
     
    Anthony Liu, Oct 24, 2005
    #1
    1. Advertising

  2. On 2005-10-24, Anthony Liu wrote:
    > We know that if we do
    >
    > print '\a'
    >
    > the bell will sound.
    >
    > Now, why do I hear the sound on my local machine when
    > I run a python script on a remote host?
    >
    > I understand if I hear it when I do
    >
    > print '\a'
    >
    > on my local machine.
    >
    > Does the command get sent back to the client machine?


    The code is printed to stdout, which is your terminal. Your
    terminal interprets ^G as a beep.

    --
    Chris F.A. Johnson <http://cfaj.freeshell.org>
    ==================================================================
    Shell Scripting Recipes: A Problem-Solution Approach, 2005, Apress
    <http://www.torfree.net/~chris/books/cfaj/ssr.html>
     
    Chris F.A. Johnson, Oct 24, 2005
    #2
    1. Advertising

  3. Anthony Liu wrote:

    > We know that if we do
    >
    > print '\a'
    >
    > the bell will sound.
    >
    > Now, why do I hear the sound on my local machine when
    > I run a python script on a remote host?


    Because print '\a' just prints the BEL ASCII character, which most
    terminals respond by beeping. Since, when you're logged into a remote
    machine, it's your terminal that's displaying the output of your remote
    session, that's why you hear the beep on your local machine.

    --
    Erik Max Francis && && http://www.alcyone.com/max/
    San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
    Maybe soul mates exist / After all
    -- Des'ree
     
    Erik Max Francis, Oct 24, 2005
    #3
  4. Anthony Liu

    Guest

    I thought that is just a "terminal" thing(extend ASCII that interpreted
    by the terminal)? If you have a terminal attached to a host, shouldn't
    this be making sound on the terminal rather than the server ? This not
    alsa or output to the server device, but straightly sending '\a' back
    to the client machine I believe.

    Anthony Liu wrote:
    > We know that if we do
    >
    > print '\a'
    >
    > the bell will sound.
    >
    > Now, why do I hear the sound on my local machine when
    > I run a python script on a remote host?
    >
    > I understand if I hear it when I do
    >
    > print '\a'
    >
    > on my local machine.
    >
    > Does the command get sent back to the client machine?
    >
    > Thanks.
    >
    > __________________________________________________
    > Do You Yahoo!?
    > Tired of spam? Yahoo! Mail has the best spam protection around
    > http://mail.yahoo.com
     
    , Oct 24, 2005
    #4
    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. Jay
    Replies:
    1
    Views:
    368
    Chris Taylor
    Oct 2, 2003
  2. =?ISO-8859-1?Q?Andreas_R=F8sdal?=

    Interesting Casting question

    =?ISO-8859-1?Q?Andreas_R=F8sdal?=, Mar 3, 2004, in forum: Java
    Replies:
    3
    Views:
    346
    Tony Morris
    Mar 3, 2004
  3. Christian Bongiorno
    Replies:
    2
    Views:
    357
    Fahd Shariff
    May 10, 2004
  4. Replies:
    6
    Views:
    413
    Ian T
    Dec 10, 2004
  5. David Cournapeau

    print a vs print '%s' % a vs print '%f' a

    David Cournapeau, Dec 30, 2008, in forum: Python
    Replies:
    0
    Views:
    374
    David Cournapeau
    Dec 30, 2008
Loading...

Share This Page