By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,665 Members | 1,430 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,665 IT Pros & Developers. It's quick & easy.

Beeping sound [solved]

Subsciber123
P: 87
I am running a program that I wrote (a compression program {it is not finished yet}), and when I run it, my computer makes a continuous beeping sound (the same sound your computer makes if you press too many keys at once on the keyboard {in windows}). What is the cause of this beeping noise?
Nov 11 '06 #1
Share this Question
Share on Google+
9 Replies


bartonc
Expert 5K+
P: 6,596
I am running a program that I wrote (a compression program {it is not finished yet}), and when I run it, my computer makes a continuous beeping sound (the same sound your computer makes if you press too many keys at once on the keyboard {in windows}). What is the cause of this beeping noise?
Welcome to the python forum! Thanks for diving in and helping!
If you post some code, you give us a better idea of how to help you with your question. Keep posting,
Barton (moderator of this forum)
Nov 11 '06 #2

kudos
Expert 100+
P: 126
I am running a program that I wrote (a compression program {it is not finished yet}), and when I run it, my computer makes a continuous beeping sound (the same sound your computer makes if you press too many keys at once on the keyboard {in windows}). What is the cause of this beeping noise?
maybe you are outputting a beep character, for instance:
Expand|Select|Wrap|Line Numbers
  1.  
  2. print "\xA0"
  3.  
  4.  
-kudos
Nov 11 '06 #3

Subsciber123
P: 87
Since I have not yet finished the program (and there are better compression programs), here is the code:

Expand|Select|Wrap|Line Numbers
  1. def read(file):                               #reads the specified file
  2.     try:
  3.         file=open(file,"rb")
  4.     except:
  5.         file=open(file,"r")
  6.     file.seek(globv.filelocation)
  7.     text=file.read(1024)
  8.     globv.filelocation=file.tell()
  9.     file.close()
  10.     return text
  11.  
  12. def split():                             #returns
  13.     lgroups=[]
  14.     unique=[]
  15.     i=0
  16.     while i<globv.length:
  17.         lgroups.append(globv.incoming_data[i])
  18.         if lgroups[-1] not in unique:
  19.             unique.append(lgroups[-1])
  20.         i=i+1
  21.     return lgroups,unique
  22.  
  23. def int_to_char(integer):                     #changes the base of numbers to
  24.     string=""                                 #256, and represents in chars
  25.     while integer:
  26.         char=integer%256
  27.         integer=(integer-char)/256
  28.         string=string+chr(char)
  29.     return string
  30.  
  31. def compress(file):                           #controls program
  32.     globv.stop=False
  33.     globv.filelocation=0
  34.     globv.final=[]
  35.     while True:
  36.         globv.incoming_data=read(file)
  37.         if globv.incoming_data=="":
  38.             break
  39.         globv.length=len(globv.incoming_data)
  40.         globv.chunks,globv.unique=split()
  41.         globv.numbers=["empty"]*len(globv.chunks)
  42.         i=0
  43.         for chunk in globv.chunks:
  44.             globv.numbers[i]=globv.unique.index(chunk)
  45.             i=i+1
  46.         globv.max=max(globv.numbers)+1
  47.         globv.total=0
  48.         for num in globv.numbers:
  49.             globv.total=globv.total*(globv.max)+num
  50.         globv.total=int_to_char(globv.total)
  51.         globv.final.extend([globv.unique,globv.total])
  52. #        print globv.unique
  53. #        print globv.numbers
  54. #        print max(globv.numbers)
  55.         print "\n"
  56.         print globv.total
  57.     print globv.final
  58. #    print globv.chunks
  59. #    print combinations
  60.  
  61. class globv:                                  #variable holding class
  62.     pass
  63.  
  64. if __name__=="__main__":                      #for use not as a module
  65.     import time
  66.     start_time=time.time()
  67.     compress(raw_input("Compress a file: "))
  68. #    print globv.incoming_data
  69.     raw_input(time.time()-start_time)
  70.  
Nov 11 '06 #4

bartonc
Expert 5K+
P: 6,596
Yep, I've got to go with kudos; you are printing a beep character.
I ran your code and this does not happen under IDLE. I recommend NOT using the command line and using an IDE like IDLE (especially because you are not calling compress with command line arguments). There are some really great IDEs out there. You may want to try Stani's Python Editor. (PythonWin works OK, but I don't like it. But it should already be on your system). Keep posting,
Barton
Nov 11 '06 #5

Subsciber123
P: 87
I use PythonWin, only because it was on my computer, and for some reason IDLE spontaneously stopped working (even though I completely reinstalled Python a few times with a few different versions). Do you know a place where I can get a good Python developer, such as the one you mentioned before, Stani's Python Editor. If I just don't print to the screen, will the beeping stop?
Nov 12 '06 #6

bartonc
Expert 5K+
P: 6,596
I use PythonWin, only because it was on my computer, and for some reason IDLE spontaneously stopped working (even though I completely reinstalled Python a few times with a few different versions). Do you know a place where I can get a good Python developer, such as the one you mentioned before, Stani's Python Editor. If I just don't print to the screen, will the beeping stop?
If you comment out print of binary data statements, beeping will stop.
Get spe at http://pythonide.stani.be/.
Nov 12 '06 #7

bartonc
Expert 5K+
P: 6,596
I use PythonWin, only because it was on my computer, and for some reason IDLE spontaneously stopped working (even though I completely reinstalled Python a few times with a few different versions). Do you know a place where I can get a good Python developer, such as the one you mentioned before, Stani's Python Editor. If I just don't print to the screen, will the beeping stop?
Problem with IDLE is probably your firewall.
Nov 13 '06 #8

Subsciber123
P: 87
Problem with IDLE is probably your firewall.
I don't think it is: The program won't even start.

Thank you, everyone, I solved the beeping problem, and got the "Stani's Python Editor" software.
Nov 13 '06 #9

bartonc
Expert 5K+
P: 6,596
I don't think it is: The program won't even start.

Thank you, everyone, I solved the beeping problem, and got the "Stani's Python Editor" software.
Now that you've got SPE, the whole world of wxPython just opened up.
It did for me, anyway, and I like it!
Nov 13 '06 #10

Post your reply

Sign in to post your reply or Sign up for a free account.