python - AttributeError: instance has no attribute, within __init__ -


i can't seem figure out problem is,

error:

traceback (most recent call last):   file "./miningscreensaver", line 171, in <module>     miningscreensaver().loop.run()   file "./miningscreensaver", line 81, in __init__     self.rxaddress = self.getrxaddress attributeerror: miningscreensaver instance has no attribute 'getrxaddress' 

code:

#! python class miningscreensaver:     def __init__(self):         dbusgmainloop(set_as_default=true)         self.mem='activechanged'         self.dest='org.gnome.screensaver'         self.bus=sessionbus()         self.loop=mainloop()         self.bus.add_signal_receiver(self.catch,self.mem,self.dest)         self.pipe = ""          #if specify different rx address         # change rxaddress desired rx address          self.rxaddress = self.getrxaddress()   #<--------------------error here line 81         #self.rxaddress = "18x3teigc6pvtsf9atx5br7rexfuzrqxez"      def catch(self,sson):         if sson == 1: #screensaver turned on             self.start()         else: #screensaver turned off             self.stop()      def start(self):         self.pipe = popen(["cgminer -o stratum+tcp://stratum.mining.eligius.st:3334 -u " + self.rxaddress + " -p x -i 9"], shell=true)      def stop(self):         self.pipe.kill()      def getrxaddress(self):         #check if bitcoin.conf exists         cmd = "ls $home/.bitcoin/bitcoin.conf"         pipe = popen(cmd,stdout=pipe,stderr=stdout)         pout = pipe.stdout.read()         pout = pout.split()         if pout[len(pout)-5]=='no' , \           pout[len(pout)-4]=='such' , \           pout[len(pout)-3]=='file' , \           pout[len(pout)-2]=='or' , \           pout[len(pout)-1]=='directory\n':             password = self.createbitconf()               else:              #check password              password = self.checkpassword()          #launch bitcoin-qt -server         popen(["bitcoin-qt","-server"])         #access         access = serviceproxy("http://darkpenguin:"+password+"@127.0.0.1:8332")         #access.getinfo()         return access.listreceivedbyaddress(0)         #access.sendtoaddress("12ybwydjhabcvohdt8qbtemjeydqpxnvyv", 0.01)      def createbitconf(self):         randompw = self.createrandompw()         path = expanduser("~") + "/"         deffile = open("bitosbitcoinconf", "r")         newfile = open(path + ".bitcoin/bitcoin.conf","w")         line in range(1,55):             newfile.write(deffile.readline())         password = "rpcpassword="+randompw+"\n"         line in range(56,110):             newfile.write(deffile.readline())         deffile.close()         newfile.close()         return randompw      def createrandompw(self):         myrg = random.systemrandom()         length = 44         alphabet = string.ascii_letters + string.digits         pw = str().join(myrg.choice(alphabet) _ in range(length))         return pw      def checkpassword(self):         path = expanduser("~") + "/"         bitconffile = open(path + ".bitcoin/bitcoin.conf","r")         password = bitconffile.readline(56)         bitconffile.close()         return password[12:12+44-1] # "rpcpassword="+randompw+"\n"  miningscreensaver().loop.run() 

this driving me batty, both method call , method spelled same , solutions other peoples problems have been no help.

you have mixed tabs , spaces. set editor show whitespace, , you'll see problem. running python -tt option can help.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -