Форум сайта python.su
FreeBSD web02.nic.ru 8.1-RELEASE FreeBSD 8.1-RELEASE-p5 #10: Fri Sep 30 14:45:56 MSK 2011 root@web22.nic.ru:/usr/obj/usr/src/sys/HNIC-IBM pl#27 i386
Python 2.7.3
[Sun Jun 29 15:26:43 2014] [error] [client 95.84.157.181] mod_wsgi (pid=95039): Target WSGI script '/home/atemon/atemon.nichost.ru/docs/index.wsgi' cannot be loaded as Python module. [Sun Jun 29 15:26:43 2014] [error] [client 95.84.157.181] mod_wsgi (pid=95039): Exception occurred processing WSGI script '/home/atemon/atemon.nichost.ru/docs/index.wsgi'. [Sun Jun 29 15:26:43 2014] [error] [client 95.84.157.181] Traceback (most recent call last): [Sun Jun 29 15:26:43 2014] [error] [client 95.84.157.181] File "/home/atemon/atemon.nichost.ru/docs/index.wsgi", line 6, in <module> [Sun Jun 29 15:26:43 2014] [error] [client 95.84.157.181] import django.core.handlers.wsgi [Sun Jun 29 15:26:43 2014] [error] [client 95.84.157.181] File "/home/atemon/.local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 8, in <module> [Sun Jun 29 15:26:43 2014] [error] [client 95.84.157.181] from django import http [Sun Jun 29 15:26:43 2014] [error] [client 95.84.157.181] File "/home/atemon/.local/lib/python2.7/site-packages/django/http/__init__.py", line 11, in <module> [Sun Jun 29 15:26:43 2014] [error] [client 95.84.157.181] from urllib import urlencode, quote [Sun Jun 29 15:26:43 2014] [error] [client 95.84.157.181] File "/usr/local/lib/python2.7/urllib.py", line 26, in <module> [Sun Jun 29 15:26:43 2014] [error] [client 95.84.157.181] import socket [Sun Jun 29 15:26:43 2014] [error] [client 95.84.157.181] File "/usr/local/lib/python2.7/socket.py", line 67, in <module> [Sun Jun 29 15:26:43 2014] [error] [client 95.84.157.181] from _ssl import SSLError as sslerror [Sun Jun 29 15:26:43 2014] [error] [client 95.84.157.181] ImportError: cannot import name SSLError
# -*- coding: utf8 -*- import sys import os try : import sqlite3 except: print u'Нет модудя sqlite' try: import pygtk pygtk.require("2.0") except: pass try: import gtk import gtk.glade except: print("GTK Not Availible") sys.exit(1) fss=None def main(): global ff, ss ss = gtk.Builder() ss.add_from_file("kill.glade") ff=ss.get_object("window1") gg=ss.get_object("button1") gg.connect('clicked', svf) ff.show() gtk.main() return 0 def svf(widget): global ff,ss ff.destroy() ff=ss.get_object("window1") ff.show() ]if __name__ == '__main__': main(
virtualenv/src/django-mailer/mailer/locale/ru/LC_MESSAGES/django.mo virtualenv/src/django-mailer/mailer/locale/ru/LC_MESSAGES/django.po
virtualenv/src/django-mailer/mailer/locale/
SELECT S.* FROM source S LEFT JOIN source_processing SP ON SP.source_id = S.id AND SP.oper_type = 'cloud_detection' ORDER BY label DESC GROUP BY S.id,
class SourceProcessing(models.Model): """ Обработка источника данных. """ task = models.ForeignKey('task.Task', db_column='task_id', blank=True, null=True) source = models.ForeignKey('Source', db_column='source_id') operation_type = models.ForeignKey('operation.OperationType', db_column='oper_type') operation_status = models.ForeignKey('task.StatusType', db_column='oper_status') log = models.ForeignKey('common.Log', blank=True, null=True, db_column='log_id') comment = models.CharField(max_length=200, db_column='comment', verbose_name='комментарий') label = models.CharField(max_length=10, db_column='label', verbose_name='метка', blank=True, null=True) result_type = models.ForeignKey('task.ResultType', db_column='result_type', blank=True, null=True) result_obj_id = models.IntegerField(blank=True, null=True, db_column='result_id') #################################### Source.objects.all().extra(select={'obj_sorting_value':''' SELECT SP.label FROM source S LEFT JOIN source_processing SP ON SP.source_id = S.id AND SP.oper_type = 'cloud_detection' AND S.id = %s '''}, params=["КАК СЮДА ВСТАВИТЬ source.id"] ).order_by(obj_sorting_value))
Set-Cookie:sess_id=h3g1tcei4ggtn6ped6iq4e9is5; expires=Tue, 01-Jul-2014 11:56:03 GMT; domain=.iloveme.su Set-Cookie:page_unload=N
r = requests.get('http://iloveme.su/') r.cookies
<<class 'requests.cookies.RequestsCookieJar'>[Cookie(version=0, name='page_unload', value='N', port=None, port_specified=False, domain='www.iloveme.su', domain_specified=False, domain_initial_dot=False, path='/', path_specified=False, secure=False, expires=None, discard=True, comment=None, comment_url=None, rest={}, rfc2109=False)]>
client_set = db_database2.client.objects.using('database2').all()
import os from math import log """Функции про логарифмы - для последующего подсчета устойчивости словосочетаний""" def logL(p,k,n): if p == 0: return (n - k) * log(1 - p) elif p == 1: return k * log(p) else: return k * log(p) + (n - k) * log(1 - p) def logLikehoodRatioBinormal(k1, n1, k2, n2): p1 = k1 / n1 p2 = k2 / n2 p = (k1 + k2) / (n1 + n2) return 2 * (logL(p1, k1, n1) + logL(p2, k2, n2) - logL(p, k1, n1) - logL(p, k2, n2)) """ОТКРЫВАЕМ ФАЙЛ И НАРЕЗАЕМ ЕГО НА СТИХИ - ПОЛУЧАЕТСЯ СПИСОК СТИХОВ""" fileObj = open('C:/Texts/Verses/1.txt', 'r+', encoding='utf-8') verseList = fileObj.readlines() """Задаем словари""" A = {} B = {} AB = {} N = 0 """ОБЪЯСНЯЕМ ПИТОНУ, КАК ИТЕРИРОВАТЬ ПО ПОЛУЧЕННОМУ СПИСКУ СТИХОВ И КАК ОТТУДА ИЗВЛЕКАТЬ ОТДЕЛЬНЫЕ СЛОВА""" """Вот тут непонятно, как написать код так, чтобы в качестве inp Питон брал последовательно по строке из verseList. И действительно ли программа берет слова в пределах отдельных стихов? Но ответ какой-то получается""" RUSSIAN_ALPHABET = set("йцукенгшщзхъфывапролджэячсмитьбюёЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮЁ") def clearWord(word): buff = [] for char in word: if char == "ё": buff.append("ё") elif char in RUSSIAN_ALPHABET or (char == "-" and len(buff) > 0): buff.append(char) return "".join(buff).lower() words = [] for verse in verseList: verse = verse.split() words.extend(clearWord(el) for el in verse if clearWord(el)) print(words) """Результат каждый раз - другой, хотя список words всегда один и тот же""" for verse in range(len(verseList)-1): pair = words[verse], words[verse + 1] try: AB[pair] += 1 except KeyError: AB[pair] = 1 try: A[pair[0]] += 1 except KeyError: A[pair[0]] = 1 try: B[pair[1]] += 1 except KeyError: B[pair[1]] = 1 N += 1 raitings = [] for pair in AB: ab = AB[pair] anotb = A[pair[0]] - ab notab = B[pair[1]] - ab notanotb = N-A[pair[0]] - B[pair[1]] + ab raitings.append((pair, logLikehoodRatioBinormal(k1 = ab, n1 = ab + anotb, k2 = notab, n2 = notab + notanotb))) raitings.sort(key = lambda x: x[1], reverse = True) for el in raitings[:20]: print(el)
import win32service winsta=win32service.GetProcessWindowStation() desktops=winsta.EnumDesktops() print desktops
## valsList это объект QTextEdit
self._cursor = self._valsList.textCursor()
format = QtGui.QTextCharFormat()
self._cursor.format = format
self._cursor.format.setProperty(QtGui.QTextFormat.FullWidthSelection, True)
self._cursor.format.setBackground(QtCore.Qt.green )
self._cursor.format.setFontUnderline(True)
self._cursor.format.setUnderlineStyle(QtGui.QTextCharFormat.SpellCheckUnderline)
self._cursor.format.setUnderlineColor(QtCore.Qt.red);
## функция вызывается при нажатии мыши в поле QTextEdit
## здесь должно происходить выделение.
def _valsListMousePressEvent(self, event):
print(self._cursor.position())
self._cursor.setPosition( QtGui.QTextCursor.StartOfLine)
self._cursor.movePosition( QtGui.QTextCursor.EndOfLine, QtGui.QTextCursor.KeepAnchor, 1)
import urllib import urllib2 url = 'https://login.vk.com/?act=login' headers = { 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1', } data = { 'act': 'login', 'role': 'al_frame', 'expire': '', 'capcha_sid': '', 'capcha_key': '', '_origin': 'http://vk.com', 'ip_h': '0543f2aec4a37d3631', 'email': '+7**********', 'pass': '*********************' } data = urllib.urlencode(data) print data req = urllib2.Request(url, data, headers) response = urllib2.urlopen(req) the_page = response.read() print the_page
def hier(self): dist = pdist(self.A, 'euclidean') self.Z = hierarchy.linkage(dist, method='average') print self.Z return self.Z
if x: pass else: return "firststart"