Beeping sound [solved]

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Subsciber123
    New Member
    • Nov 2006
    • 87

    Beeping sound [solved]

    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?
  • bartonc
    Recognized Expert Expert
    • Sep 2006
    • 6478

    #2
    Originally posted by Subsciber123
    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)

    Comment

    • kudos
      Recognized Expert New Member
      • Jul 2006
      • 127

      #3
      Originally posted by Subsciber123
      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:
      Code:
      print "\xA0"
      -kudos

      Comment

      • Subsciber123
        New Member
        • Nov 2006
        • 87

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

        Code:
        def read(file):                               #reads the specified file
            try:
                file=open(file,"rb")
            except:
                file=open(file,"r")
            file.seek(globv.filelocation)
            text=file.read(1024)
            globv.filelocation=file.tell()
            file.close()
            return text
        
        def split():                             #returns
            lgroups=[]
            unique=[]
            i=0
            while i<globv.length:
                lgroups.append(globv.incoming_data[i])
                if lgroups[-1] not in unique:
                    unique.append(lgroups[-1])
                i=i+1
            return lgroups,unique
        
        def int_to_char(integer):                     #changes the base of numbers to
            string=""                                 #256, and represents in chars
            while integer:
                char=integer%256
                integer=(integer-char)/256
                string=string+chr(char)
            return string
        
        def compress(file):                           #controls program
            globv.stop=False
            globv.filelocation=0
            globv.final=[]
            while True:
                globv.incoming_data=read(file)
                if globv.incoming_data=="":
                    break
                globv.length=len(globv.incoming_data)
                globv.chunks,globv.unique=split()
                globv.numbers=["empty"]*len(globv.chunks)
                i=0
                for chunk in globv.chunks:
                    globv.numbers[i]=globv.unique.index(chunk)
                    i=i+1
                globv.max=max(globv.numbers)+1
                globv.total=0
                for num in globv.numbers:
                    globv.total=globv.total*(globv.max)+num
                globv.total=int_to_char(globv.total)
                globv.final.extend([globv.unique,globv.total])
        #        print globv.unique
        #        print globv.numbers
        #        print max(globv.numbers)
                print "\n"
                print globv.total
            print globv.final
        #    print globv.chunks
        #    print combinations
        
        class globv:                                  #variable holding class
            pass
        
        if __name__=="__main__":                      #for use not as a module
            import time
            start_time=time.time()
            compress(raw_input("Compress a file: "))
        #    print globv.incoming_data
            raw_input(time.time()-start_time)

        Comment

        • bartonc
          Recognized Expert Expert
          • Sep 2006
          • 6478

          #5
          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

          Comment

          • Subsciber123
            New Member
            • Nov 2006
            • 87

            #6
            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?

            Comment

            • bartonc
              Recognized Expert Expert
              • Sep 2006
              • 6478

              #7
              Originally posted by Subsciber123
              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/.

              Comment

              • bartonc
                Recognized Expert Expert
                • Sep 2006
                • 6478

                #8
                Originally posted by Subsciber123
                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.

                Comment

                • Subsciber123
                  New Member
                  • Nov 2006
                  • 87

                  #9
                  Originally posted by bartonc
                  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.

                  Comment

                  • bartonc
                    Recognized Expert Expert
                    • Sep 2006
                    • 6478

                    #10
                    Originally posted by Subsciber123
                    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!

                    Comment

                    Working...