> > Hi when I disconnect the internet I get an error NameError: name 'self' is > not defined. I really dont get it.. thanks all. Is that a bug? or my fault?
Exception in thread Thread-1: > Traceback (most recent call last): > File "C:\programming Alon\stock market app\PROJECT\AlonStockMarket.py", > line 93, in secret > print(ping('google.com')) > File "C:\programming Alon\stock market app\PROJECT\AlonStockMarket.py", > line 72, in ping > conn.connect((addr, 80)) > socket.gaierror: [Errno 11001] getaddrinfo failed > During handling of the above exception, another exception occurred: > Traceback (most recent call last): > File > "C:\Users\Alon\AppData\Local\Programs\Python\Python37-32\lib\threading.py", > line 917, in _bootstrap_inner > self.run() > File > "C:\Users\Alon\AppData\Local\Programs\Python\Python37-32\lib\threading.py", > line 865, in run > self._target(*self._args, **self._kwargs) > File "C:\programming Alon\stock market app\PROJECT\AlonStockMarket.py", > line 95, in secret > self.pushButton.setDisabled(True) > NameError: name 'self' is not defined Looks like `self` is supposed to be referring to an instance of the class `Ui_AlonStockMarketApp` (which has the pushButton attribute) but you've defined the secret function outside of that class. Try defining that function inside your class. HTH, Chris -- https://mail.python.org/mailman/listinfo/python-list