Форум сайта python.su
<?xml version="1.0"?> <Scene> <Line> <Enemy>1 20</Enemy> <Enemy>4 22</Enemy> <Enemy>2 24</Enemy> </Line> <Line> <Enemy>123 20</Enemy> <Enemy>123 22</Enemy> <Enemy>123 24</Enemy> </Line> </Scene>
import sys from cx_Freeze import setup, Executable base = None if sys.platform == "win64": base = "Win64GUI" setup( name = "simple_PyQt4", version = "0.1", description = "Sample cx_Freeze PyQt4 script", options = {"build_exe" : {"includes" : "atexit" }}, executables = [Executable("modulev6.py", base = base)])
cd c:\ C:\setup.py build
serg@serg-virtual-machine:~$ easy_install scipy
Searching for scipy
Reading http://pypi.python.org/simple/scipy/
Reading http://www.scipy.org
Reading http://sourceforge.net/project/showfiles.php?group_id=27747&package_id=19531
Reading http://new.scipy.org/Wiki/Download
Best match: scipy 0.10.1
Downloading http://pypi.python.org/packages/source/s/scipy/scipy-0.10.1.zip#md5=4156cc1b765eb186de9518a94b6c3518
Processing scipy-0.10.1.zip
Running scipy-0.10.1/setup.py -q bdist_egg –dist-dir /tmp/easy_install-qEnJVP/scipy-0.10.1/egg-dist-tmp-vNP_b8
Running from scipy source directory.
/usr/local/lib/python2.7/dist-packages/numpy-1.6.2-py2.7-linux-x86_64.egg/numpy/distutils/system_info.py:1425: UserWarning:
Atlas (http://math-atlas.sourceforge.net/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section ) or by setting
the ATLAS environment variable.
warnings.warn(AtlasNotFoundError.__doc__)
/usr/local/lib/python2.7/dist-packages/numpy-1.6.2-py2.7-linux-x86_64.egg/numpy/distutils/system_info.py:1434: UserWarning:
Blas (http://www.netlib.org/blas/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section ) or by setting
the BLAS environment variable.
warnings.warn(BlasNotFoundError.__doc__)
/usr/local/lib/python2.7/dist-packages/numpy-1.6.2-py2.7-linux-x86_64.egg/numpy/distutils/system_info.py:1437: UserWarning:
Blas (http://www.netlib.org/blas/) sources not found.
Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section ) or by setting
the BLAS_SRC environment variable.
warnings.warn(BlasSrcNotFoundError.__doc__)
error:
Blas (http://www.netlib.org/blas/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section ) or by setting
the BLAS environment variable.
class MyWindow(QtGui.QWidget): def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.label = QtGui.QLabel( '<BODY LINK="#FF0000" VLINK="#FF6600" ALINK="#000000">\ <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=10>\ <TR>\ <TD WIDTH=1024 HEIGHT=500 BGCOLOR="#00FFFF" valign=top></TD>\ </TR>\ </TABLE>\ </BODY>') self.label.setAlignment(QtCore.Qt.AlignTop) self.vbox = QtGui.QVBoxLayout() self.vbox.addWidget(self.label) self.setLayout(self.vbox) self.connect(self.button, QtCore.SIGNAL('clicked()'), self.summ)
session.query(Users.id, Users.name).all()
import os def archive_check(): s2 = os.access("Z:\\TrassirArchive", os.F_OK) if s2 == True: settings("archive/z")["read_only"] = 0 timeout(30*1000) settings("archive/f")["read_only"] = 1 settings("archive/d")["read_only"] = 1 timeout(10*1000, archive_check) else: settings("archive/f")["read_only"] = 0 settings("archive/d")["read_only"] = 0 alert("Íå äîñòóïåí âíåøíèé ìàññèâ!")# %s") %s2) timeout(10*1000, archive_check) timeout(0, archive_check)
import socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind(('localhost', 8000)) s.listen(5) while True: try: client, addr = s.accept() while True: data = client.recv(1024) if data: print("Data: %s" % data) except Exception, ex: print("Some exception!\n",ex) try: print("IP: {ip}".format(ip=addr)) print("Host: {name}".format(name=socket.gethostbyaddr(str(addr)))) except (NameError, socket.error): pass
import os import socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind(('localhost', 8000)) s.listen(5) def archive_check(): s2 = os.access("Z:\\TrassirArchive", os.F_OK) if s2 == True: try: client, addr = s.accept() while True: data = client.recv(1024) if data: print("Data: %s" % data) except Exception, ex: print("Some exception!\n",ex) try: print("IP: {ip}".format(ip=addr)) print("Host: {name}".format(name=socket.gethostbyaddr(str(addr)))) except (NameError, socket.error): pass settings("archive/z")["read_only"] = 0 timeout(30*1000) settings("archive/f")["read_only"] = 1 settings("archive/d")["read_only"] = 1 timeout(10*1000, archive_check) else: settings("archive/f")["read_only"] = 0 settings("archive/d")["read_only"] = 0 alert("Íå äîñòóïåí âíåøíèé ìàññèâ!")# %s") %s2) timeout(10*1000, archive_check) timeout(0, archive_check)
import urllib2 proxy_support = urllib2.ProxyHandler({}) opener = urllib2.build_opener(proxy_support) urllib2.install_opener(opener)
Traceback (most recent call last): File "D:/work/project/Scripts/html_parser.py", line 8, in <module> a = urllib2.urlopen('http://yandex.ru/') File "C:\Python27\lib\urllib2.py", line 126, in urlopen return _opener.open(url, data, timeout) File "C:\Python27\lib\urllib2.py", line 400, in open response = self._open(req, data) File "C:\Python27\lib\urllib2.py", line 418, in _open '_open', req) File "C:\Python27\lib\urllib2.py", line 378, in _call_chain result = func(*args) File "C:\Python27\lib\urllib2.py", line 1207, in http_open return self.do_open(httplib.HTTPConnection, req) File "C:\Python27\lib\urllib2.py", line 1177, in do_open raise URLError(err) urllib2.URLError: <urlopen error [Errno 10051] >
IDLE 2.6.6
>>> import xmlsecmod
Traceback (most recent call last):
File “<pyshell#0>”, line 1, in <module>
import xmlsecmod
ImportError: DLL load failed: Не найден указанный модуль.
class VoteObject(models.Model): class Meta: verbose_name = u'Голосування' verbose_name_plural = _(u'Голосування') type = models.IntegerField(_(u'Тип оьекта')) object_id = models.IntegerField(_(u'Id обьекта')) user_id = models.IntegerField(_(u'Id користувача')) vote_value = models.IntegerField(_(u'+1/-1')) def __init__(self, *args, **kwargs): super(VoteObject, self).__init__(*args, **kwargs) self.usern = User.objects.get(id=self.user_id).username if self.type==0: self.tit = News.objects.get(id=self.object_id).title self.typen = u"Стаття" if self.type==1: self.typen = u"Блог" def username(self): return self.usern def typename(self): return self.typen def _get_title(self): return self.tit def _set_title(self, value): self.tit = value title = property(_get_title,_set_title)
def activate_flash_menu(event): click_x, click_y = mainframe1_canvas.winfo_pointerxy() flash_menu.tk_popup(click_x, click_y)