kopia lustrzana https://github.com/sq9atk/sr0wx
Brak połączenia z internetem - obsługa wyjątku
rodzic
e4e0462d40
commit
de15254804
|
@ -64,6 +64,7 @@ import pl_google.pl_google as pl_google
|
||||||
lang = "pl_google"
|
lang = "pl_google"
|
||||||
pygame_bug = 0
|
pygame_bug = 0
|
||||||
|
|
||||||
|
data_sources_error_msg = ['_','zrodlo_danych_niedostepne']
|
||||||
hello_msg = ['_','tu_eksperymentalna_automatyczna_stacja_pogodowa','sr0wx']
|
hello_msg = ['_','tu_eksperymentalna_automatyczna_stacja_pogodowa','sr0wx']
|
||||||
goodbye_msg = ['_','tu_sr0wx']
|
goodbye_msg = ['_','tu_sr0wx']
|
||||||
read_sources_msg = False
|
read_sources_msg = False
|
||||||
|
|
Plik binarny nie jest wyświetlany.
Plik binarny nie jest wyświetlany.
13
sr0wx.py
13
sr0wx.py
|
@ -77,6 +77,7 @@ import pygame
|
||||||
import sys
|
import sys
|
||||||
import logging, logging.handlers
|
import logging, logging.handlers
|
||||||
import numpy
|
import numpy
|
||||||
|
import urllib2
|
||||||
|
|
||||||
# ``os``, ``sys`` and ``time`` doesn't need further explanation, these are
|
# ``os``, ``sys`` and ``time`` doesn't need further explanation, these are
|
||||||
# syandard Python packages.
|
# syandard Python packages.
|
||||||
|
@ -160,6 +161,18 @@ if len(args) > 0:
|
||||||
else:
|
else:
|
||||||
modules = config.modules
|
modules = config.modules
|
||||||
|
|
||||||
|
try:
|
||||||
|
dane = urllib2.urlopen('http://google.pl', None, 30);
|
||||||
|
except urllib2.URLError, e:
|
||||||
|
modules = []
|
||||||
|
message += " ".join(config.data_sources_error_msg)
|
||||||
|
logger.info(COLOR_FAIL + "Brak połączenia z internetem" + COLOR_ENDC + "\n")
|
||||||
|
except socket.timeout:
|
||||||
|
modules = []
|
||||||
|
message += " ".join(config.data_sources_error_msg)
|
||||||
|
logger.info(COLOR_FAIL + "Brak połączenia z internetem" + COLOR_ENDC + "\n")
|
||||||
|
|
||||||
|
|
||||||
lang = my_import('.'.join((config.lang, config.lang)))
|
lang = my_import('.'.join((config.lang, config.lang)))
|
||||||
sources = [lang.source, ]
|
sources = [lang.source, ]
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue