urllib.request with proxy and HTTPS

2017-06-30 Thread Pavel Volkov
Hello, I'm trying to make an HTTPS request with urllib. OS: Gentoo Python: 3.6.1 openssl: 1.0.2l This is my test code: = CODE BLOCK BEGIN = import ssl import urllib.request from lxml import etree PROXY = 'proxy.vpn.local:' URL = "https://google.com"; proxy = urllib.request.ProxyHa

Re: Announcement: PythonQL - An integrated query language for Python

2016-11-01 Thread Pavel Velikhov
On Tuesday, 1 November 2016 20:09:14 UTC+3, Peter Otten wrote: > Pavel Velikhov wrote: > > > On Tuesday, 1 November 2016 12:50:37 UTC+3, Peter Otten wrote: > >> Pavel Velikhov wrote: > >> > >> > We have released PythonQL, a query language extension to

Re: Announcement: PythonQL - An integrated query language for Python

2016-11-01 Thread Pavel Velikhov
On Tuesday, 1 November 2016 20:16:43 UTC+3, Michael Torrie wrote: > On 11/01/2016 02:56 AM, Pavel Velikhov wrote: > > Hi Folks, > > > > We have released PythonQL, a query language extension to Python (we > > have extended Python’s comprehensions with a full-fledged

Re: Announcement: PythonQL - An integrated query language for Python

2016-11-01 Thread Pavel Velikhov
On Tuesday, 1 November 2016 12:50:37 UTC+3, Peter Otten wrote: > Pavel Velikhov wrote: > > > We have released PythonQL, a query language extension to Python (we have > > extended Python’s comprehensions with a full-fledged query language, > > drawing from the useful fea

Announcement: PythonQL - An integrated query language for Python

2016-11-01 Thread Pavel Velikhov
Hi Folks, We have released PythonQL, a query language extension to Python (we have extended Python’s comprehensions with a full-fledged query language, drawing from the useful features of SQL, XQuery and JSONiq). Take a look at the project here: http://www.pythonql.org and lets us know what you

Python grammar extension via encoding (pyxl style) questions

2016-09-29 Thread Pavel Velikhov
python and especially in Jupyter notebooks. Would you have any advise on how to approach these? Thanks in advance! Pavel Velikhov P.S. Here's the demo site for our project,if you're interested: www.pythonql.org -- https://mail.python.org/mailman/listinfo/python-list

Re: C Python extension to export an Function

2016-09-01 Thread Pavel S
If you're familiar with C++, I recommend to have a look at Boost::Python. Sample program: #include #include void world() { std::cout << "hello world" << std::endl; } BOOST_PYTHON_MODULE( hello ) { using namespace ::boost::python; def( "world", &world ); } Usage: python -c "i

Re: __all__ attribute: bug and proposal

2016-06-27 Thread Pavel S
> but what about integers or strings? Can you provide example? --- No matter if __all__ uses names or objects, I think it should be validated not only when importing '*', but always. Frankly, do you always unit-test if __all__ works? -- https://mail.python.org/mailman/listinfo/python-list

__all__ attribute: bug and proposal

2016-06-27 Thread Pavel S
Hi, I today uncovered subtle bug and would like to share it with you. By a mistake, I forgot to put comma into '__all__' tuple of some module. Notice missing comma after 'B'. # module foo.py __all__ = ( 'A', 'B' 'C', ) class A: pass class B: pass class C: pass If you try to import

Re: mod_python compilation error in VS 2008 for py2.7.1

2016-06-14 Thread Pavel S
Have you considered to use rather WSGI-based solution? (for Apache Httpd is mod_wsgi). Mod_python is totally obsolete. -- https://mail.python.org/mailman/listinfo/python-list

Re: errorhandler 2.0.0 Released!

2016-06-06 Thread Pavel S
Hi, can you explain, why is the attribute 'fired' class-level and not instance-level? There must be good reason for modifying class attribute from instance. Dne pondělí 6. června 2016 15:26:08 UTC+2 Chris Withers napsal(a): > Hi All, > > errorhandler is a tiny but useful logging handler for th

Caching function results

2016-03-03 Thread Pavel Volkov
Suppose, I have some resource-intensive tasks implemented as functions in Python. Those are called repeatedly in my program. It's guranteed that a call with the same arguments always produces the same return value. I want to cache the arguments and return values and in case of repititive call i

Re: anyone tell me why my program will not run?

2015-11-21 Thread Pavel Volkov
On суббота, 21 ноября 2015 г. 6:30:02 MSK, Dylan Riley wrote: Also some more notes: heads = int("1") tails = int("2") Why use this strange initialization? The usual way: heads = 1 tails = 2 gives the same result. while flips != 0: flips -= 1 There's no need to use while and flips vari

Re: anyone tell me why my program will not run?

2015-11-21 Thread Pavel Volkov
On суббота, 21 ноября 2015 г. 6:30:02 MSK, Dylan Riley wrote: i am learning python and was tasked with making a program that flips a coin 100 times and then tells you the number of heads and tails. First, you have a syntax error: if result = heads: should be: if result == heads: Second, ther

Re: Successfully send sms with python

2015-09-23 Thread Pavel S
I don't understand why all of you are telling him about '\r\n\, write(),..' instead of recommending to use take library which already has all problems resolved (python-gammu / wammu). When one will write custom templating stuff, you would also recommend him to take jinja. -- https://mail.pytho

Re: Successfully send sms with python

2015-09-22 Thread Pavel S
On Tuesday, September 22, 2015 at 1:20:07 PM UTC+2, Timon Rhynix wrote: > Hello, I have used pyserial, sms0.4 and other libraries to send sms via > huawei E1750 modem. > The code runs well and no error is thrown but the text message is not > sent/delivered to the number. > One of my code is as fo

Re: GOTCHA with list comprehension

2015-08-05 Thread Pavel S
Hi Chris, yeah, I have to stick on the software which my employer provides to me (we're enterprise company). I'm not root on that system. I'm happy with 2.6 now, two years ago we were on older RHEL with python 2.4 and it was a real pain :) > > $ cat /etc/redhat-release > > Red Hat Enterprise Li

Re: GOTCHA with list comprehension

2015-08-05 Thread Pavel S
$ cat /etc/redhat-release Red Hat Enterprise Linux Server release 6.5 (Santiago) $ python --version Python 2.6.6 > Incidentally, why Python 2.6? > > ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: GOTCHA with list comprehension

2015-08-05 Thread Pavel S
True if True if True if True ] Dne středa 5. srpna 2015 8:49:20 UTC+2 Pavel S napsal(a): > Hi, > > I recently found interesting GOTCHA while doing list comprehension in python > 2.6: > > >>> values = ( True, False, 1, 2, 3, None ) > >>> [ value for valu

GOTCHA with list comprehension

2015-08-04 Thread Pavel S
Hi, I recently found interesting GOTCHA while doing list comprehension in python 2.6: >>> values = ( True, False, 1, 2, 3, None ) >>> [ value for value in values if value if not None ] [True, 1, 2, 3] I was wondering why this list comprehension returns incorrect results and finally found a typ

We're looking for a middle python developer in Moscow

2015-07-21 Thread pavel
Hello everybody! We're looking for a well-experienced python developer who'd like to participate in educational startup in Moscow, Russia. It's going to be a contractor's job position for 6 months with possible prolongation. Here is the link: http://edumate.ru Main milestones for work complet

Using map()

2014-11-16 Thread Pavel Volkov
I checked my modules with pylint and saw the following warning: W: 25,29: Used builtin function 'map' (bad-builtin) Why is the use of map() discouraged? It' such a useful thing. -- https://mail.python.org/mailman/listinfo/python-list

object().__dict__

2014-04-22 Thread Pavel Volkov
There are some basics about Python objects I don't understand. Consider this snippet: class X: pass ... x = X() dir(x) ['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '_

Re: python for everyday tasks

2013-11-27 Thread Pavel Volkov
On Saturday 23 November 2013 02:01:26 Steven D'Aprano wrote: > * Python is not Java, and Java is not Python either: > > http://dirtsimple.org/2004/12/python-is-not-java.html > http://dirtsimple.org/2004/12/java-is-not-python-either.html Thanks for all those references. There's this statement in t

Re: Yet another Python textbook

2012-11-21 Thread Pavel Solin
b. New release is coming in one or two weeks. Cheers, Pavel On Wed, Nov 21, 2012 at 4:34 PM, Alec Taylor wrote: > Dear Prof. Solin, > > Can you put your website—http://femhub.com/textbook-python/—on your > github—https://github.com/femhub/nclab-textbook-python? > > I will then

Re: Yet another Python textbook

2012-11-20 Thread Pavel Solin
Hi Ian, thank you for your comments. On Mon, Nov 19, 2012 at 11:46 PM, Ian Kelly wrote: > On Sun, Nov 18, 2012 at 10:30 PM, Pavel Solin > wrote: > > I would like to introduce a new Python textbook > > aimed at high school students: > > > > http://femhub.com

Yet another Python textbook

2012-11-18 Thread Pavel Solin
, every contributor becomes automatically a co-author. Best regards, Pavel -- Pavel Solin Associate Professor Applied and Computational Mathematics University of Nevada, Reno http://hpfem.org/~pavel -- http://mail.python.org/mailman/listinfo/python-list

Re: how many days in one year ?

2012-04-22 Thread Pavel Anossov
import calendar print 366 if calendar.isleap(2003) else 365 On 22 April 2012 13:37, contro opinion wrote: > i want to know how many days in one year, > import time > import datetime > d1= datetime.datetime(2003, 1, 1) > d2=datetime.datetime(2003, 21, 31) > print  (d2-d1).days+1 > > i can get t

Re: Zipping a dictionary whose values are lists

2012-04-12 Thread Pavel Anossov
zip(*d.values()) On 12 April 2012 20:28, wrote: > I using Python 3.2 and have a dictionary d = {0:[1,2], 1:[1,2,3], 2:[1,2,3,4]} > > whose values are lists I would like to zip into a list of tuples. If I > explicitly write: list(zip([1,2], [1,2,3], [1,2,3,4]) > [(1, 1, 1), (2, 2, 2)]

Web browser Python programming in NCLab

2012-02-15 Thread Pavel Solin
lab-u...@googlegroups.com. We hope to hear from you! Best, Pavel -- Pavel Solin University of Nevada, Reno http://hpfem. <http://hpfem.math.unr.edu/people/pavel/>org/~pavel -- http://mail.python.org/mailman/listinfo/python-list

Re: Py3K: file inheritance

2011-10-21 Thread Yosifov Pavel
On 21 окт, 13:50, Ian Kelly wrote: > On Thu, Oct 20, 2011 at 10:17 PM, Yosifov Pavel wrote: > > Little silly example: > > > class MyFile(file): > > šdef __init__(self, *a, **ka): > > š šsuper(MyFile, self).__init__(*a, **ka) > > š šself.commented =

Re: Py3K: file inheritance

2011-10-20 Thread Yosifov Pavel
On 21 окт, 00:42, Ian Kelly wrote: > On Thu, Oct 20, 2011 at 11:28 AM, Yosifov Pavel wrote: > > In the Python 2.x was simple to create own file object: > > > class MyFile(file): > > špass > > > for example to reimplement write() or something else. How to do it in

Py3K: file inheritance

2011-10-20 Thread Yosifov Pavel
In the Python 2.x was simple to create own file object: class MyFile(file): pass for example to reimplement write() or something else. How to do it in Python 3.x? -- http://mail.python.org/mailman/listinfo/python-list

Windows and Linux Tips

2010-05-31 Thread Pavel Haque
Hi Friends, For Windows and Linux Tips, Please Visit: www.windowsandlinuxtips.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Overriding module's class

2009-12-03 Thread Pavel Skvazh
Is it possible to override a class in the module or the module itself that is imported across the project to add new methods to it? For example I've got module 'a' with class A from a import A but I don't want to add a method to that A class not just in this unit, but across the project, so eve

Re: Distutils evil voodoo: install into a package

2009-08-28 Thread Pavel Panchekha
> This is what whe world has created namespace-packages for. At least if > you can live with the namespace "pya" being otherwise empty. That seems like a good solution. Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Distutils evil voodoo: install into a package

2009-08-24 Thread Pavel Panchekha
Before you flame me, I know that what I'm trying to do is beyond evil. But I nonetheless want to do it. Feel free to rant if you must. :) I have a package that I want to install into another package. For example, I have the packages pya and pyb. pya is guaranteed to be installed before pyb is, so

Re: Inheriting dictionary

2009-08-18 Thread Pavel Panchekha
On Aug 18, 5:11 pm, "Jan Kaliszewski" wrote: > 18-08-2009 o 22:27:41 Nat Williams wrote: > > > > > On Tue, Aug 18, 2009 at 2:44 PM, Pavel Panchekha   > > wrote: > > >> I want a dictionary that will transparently "inherit" from a pa

Re: Inheriting dictionary

2009-08-18 Thread Pavel Panchekha
On Aug 18, 4:23 pm, "Jan Kaliszewski" wrote: > 18-08-2009 o 21:44:55 Pavel Panchekha wrote: > > > > > I want a dictionary that will transparently "inherit" from a parent > > dictionary. So, for example: > > > """ > > a = I

Inheriting dictionary

2009-08-18 Thread Pavel Panchekha
I want a dictionary that will transparently "inherit" from a parent dictionary. So, for example: """ a = InheritDict({1: "one", 2: "two", 4: "four"}) b = InheritDict({3: "three", 4: "foobar"}, inherit_from=a) a[1] # "one" a[4] # "four" b[1] # "one" b[3] # "three" b[4] # "foobar" """ I've written

Re: Overriding methods per-object

2009-04-19 Thread Pavel Panchekha
On Apr 18, 9:43 pm, Aaron Brady wrote: > On Apr 17, 9:41 pm, Steven D'Aprano > cybersource.com.au> wrote: > > On Fri, 17 Apr 2009 18:22:49 -0700, Pavel Panchekha wrote: > > > I've got an object which has a method, __nonzero__ The problem is, that > > >

Re: Overriding methods per-object

2009-04-18 Thread Pavel Panchekha
On Apr 18, 4:01 pm, Piet van Oostrum wrote: > But you can give each object its own class and then put the special > methods in that class: > > >>> def create_special_object(bases, *args): > > ...   if not isinstance(bases, tuple): > ...      bases = bases, > ...   cls = type("SpecialClass", bases,

Re: Overriding methods per-object

2009-04-17 Thread Pavel Panchekha
> The docs don't say you can do that: Thanks, hadn't noticed that. > Should you be able to? I'd say so. In my case, I need a class that can encapsulate any object, add a few methods to it, and spit something back that works just like the object, but also has those extra methods. I can't just add

Overriding methods per-object

2009-04-17 Thread Pavel Panchekha
I've got an object which has a method, __nonzero__ The problem is, that method is attached to that object not that class > a = GeneralTypeOfObject() > a.__nonzero__ = lambda: False > a.__nonzero__() False But: > bool(a) True What to do? -- http://mail.python.org/mailman/listinfo/python-list

typedef (type alias) and ctypes

2009-02-07 Thread Yosifov Pavel
ulong,),{}) >>> x = t1() >>> y = t2() >>> type(x)==type(y) False The problem: 1st way work in complex using of ctypes (interfacing with some DLLs), but doesn't allow to determine real type! 2st way allows to determine real type, but "access violation

patch

2009-01-06 Thread Pavel Kosina
sorry, pls forget ... -- geon Pavel Kosina -- http://mail.python.org/mailman/listinfo/python-list

patch

2009-01-03 Thread Pavel Kosina
h.c, line 354 This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. Patchuje někdo tady pod Windows? Díky -- geon Pavel Kosina -- http://mail.python.org/mailman/listinfo/python-list

Re: idle 3.0 unicode

2009-01-01 Thread Pavel Kosina
小楼 napsal(a), dne 1.1.2009 10:32: #coding="utf-8" #中国 print('a') saved in utf8 alt+x,destroyed IDLE... me too,why? Are you sure? Run (F5) with print('a') is OK here. Maybe you have redefined key bindings in IDLE ... -- geon Pavel Kosina -- http://mail.pyth

idle 3.0 unicode

2009-01-01 Thread Pavel Kosina
IDLE window without any error message. -- geon Pavel Kosina -- http://mail.python.org/mailman/listinfo/python-list

Re: tkinter 3.0 multiple keyboard events together

2008-12-28 Thread Pavel Kosina
janislaw napsal(a): Um, I could be only guessing what are you meant to do, unless you describe your problem in more detailed way. I.e. describe the desired behaviour, show code which you have, and describe the current behaviour. well, I am working on a tutorial for youngster (thats why i ne

Re: tkinter 3.0 multiple keyboard events together

2008-12-27 Thread Pavel Kosina
janislaw napsal(a): Use google to find the appropriate site, or browse this site, there are plenty of examples. You may want to examine the code I wrote to you to catch the idea: #-- import Tkinter import pprint tk = Tkinter.Tk() f = Tkinter.Frame(tk, width=100, height=100) m

Re: tkinter 3.0 multiple keyboard events together

2008-12-26 Thread Pavel Kosina
janislaw napsal(a): On 26 Gru, 05:52, Pavel Kosina wrote: Is it possible to catch in an event more that one key from keyboard? In my code, I can handle always the only one, the first I press, the others are omitted. Say, I press both "4" and "8" and only "4&quo

tkinter 3.0 multiple keyboard events together

2008-12-25 Thread Pavel Kosina
Is it possible to catch in an event more that one key from keyboard? In my code, I can handle always the only one, the first I press, the others are omitted. Say, I press both "4" and "8" and only "4" is catched. def movePlayer(event): print (event.keysym) Th

Re: iterator clone

2008-07-16 Thread Yosifov Pavel
On 16 июл, 11:32, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Tue, 15 Jul 2008 19:54:30 -0700, Yosifov Pavel wrote: > > Kay, can you show example of such generator? ReIter, for example, work > > with usual generators. > > > But for "bi

Re: iterator clone

2008-07-15 Thread Yosifov Pavel
tate, side- effects)... Best regards, Pavel -- http://mail.python.org/mailman/listinfo/python-list

Re: iterator clone

2008-07-14 Thread Yosifov Pavel
On 14 июл, 23:36, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On 13 juil, 12:05, Yosifov Pavel <[EMAIL PROTECTED]> wrote: > (snip) > > > defcloneiter( it ): > > """return (clonable,clone)""" > > return tee

Re: iterator clone

2008-07-14 Thread Yosifov Pavel
external state (side-effects) or not, may be is needed some new class-protocol for it... or something else. Or another way: iterators may be re-iterable always, but if programmer need to point to the extra- (external) state, he has to raise some a special exception in __iter)) method... OK, it

Re: iterator clone

2008-07-13 Thread Yosifov Pavel
e method for copy itself (the tee() implementation) or be "re- startable". Why not? Concrete problem was to generate iterators (iterator of slices). It was solved with ReIter. --Best regards, --pavel -- http://mail.python.org/mailman/listinfo/python-list

Re: iterator clone

2008-07-13 Thread Yosifov Pavel
On 13 июл, 14:12, Peter Otten <[EMAIL PROTECTED]> wrote: > Yosifov Pavel wrote: > > Whats is the way to clone "independent" iterator? I can't use tee(), > > because I don't know how many "independent" iterators I need. copy and > > deepcop

iterator clone

2008-07-12 Thread Yosifov Pavel
Whats is the way to clone "independent" iterator? I can't use tee(), because I don't know how many "independent" iterators I need. copy and deepcopy doesn't work... --pavel -- http://mail.python.org/mailman/listinfo/python-list

Re: ThreadPoolingMixIn

2008-06-03 Thread pavel . uvarov
On Jun 3, 1:19 am, [EMAIL PROTECTED] wrote: > On Jun 2, 12:41 pm, [EMAIL PROTECTED] wrote: > > > > > On Jun 2, 7:15 pm, Michael Ströder <[EMAIL PROTECTED]> wrote: > > > Here are benchmarks for FreeBSD 6.2, amd64 > > > packet_size x y > > 0499.57 1114.54 > >10

Re: ThreadPoolingMixIn

2008-06-02 Thread pavel . uvarov
On Jun 2, 7:15 pm, Michael Ströder <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > To benchmark this I used a simple tcp server which writes a small > > (16k) > > string to the client and closes the connection. > > Just a general note: When benchmarking such a network service it would > b

Re: ThreadPoolingMixIn

2008-06-02 Thread pavel . uvarov
On Jun 2, 7:09 pm, [EMAIL PROTECTED] wrote: > On May 31, 9:13 pm, Rhamphoryncus <[EMAIL PROTECTED]> wrote: > > > On May 30, 2:40 pm, [EMAIL PROTECTED] wrote: > > > > Hi, everybody! > > > > I wrote a useful class ThreadPoolingMixIn which can be used to create > > > fast thread-based servers. This mi

Re: ThreadPoolingMixIn

2008-06-02 Thread pavel . uvarov
): """Mix-in class to handle requests in a thread pool. The pool grows and thrinks depending on load. For instance, a threadpooling TCP server class is created as follows: class ThreadPoolingUDPServer(ThreadPoolingMixIn, TCPServer): pass ""&

ThreadPoolingMixIn

2008-05-30 Thread pavel . uvarov
s created as follows: class ThreadPoolingUDPServer(ThreadPoolingMixIn, UDPServer): pass """ __author__ = 'Pavel Uvarov <[EMAIL PROTECTED]>' def init_thread_pool(self, min_workers = 5, max_workers = 100, min_spare_workers = 5):

Re: Unhandled exceptions checking

2008-05-25 Thread Yosifov Pavel
On 24 май, 12:58, bukzor <[EMAIL PROTECTED]> wrote: > On May 23, 6:31 pm, Yosifov Pavel <[EMAIL PROTECTED]> wrote: > > > Does somebody know existent tool for checking unhandled exceptions? > > Like in Java when method throws exception but in code using this > >

Unhandled exceptions checking

2008-05-23 Thread Yosifov Pavel
Does somebody know existent tool for checking unhandled exceptions? Like in Java when method throws exception but in code using this method, try...catch is missed. May be something like PyChecker? -- /Pavel -- http://mail.python.org/mailman/listinfo/python-list

Re: Error while installing Python2.5.1

2007-06-21 Thread Pavel
.log' for more details. It appears you have no C compiler installed. You should be able to get one of those from your distribution's repositories. If you can't, upgrade to something debian-based. /pavel -- http://mail.python.org/mailman/listinfo/python-list

Re: How to comment code?

2007-01-19 Thread Pavel Panchekha
I think that doc strings are the most important way in which you should be commenting on your code. Once the code works, you can elimainate most inline comments, leaving only doc string for everything and a few comments on some particularly confusing parts. Other than that, comments usually only cl

Re: Help with autotools

2006-09-03 Thread pavel . starek
://www.bani.com.br > MSN: [EMAIL PROTECTED] > GTalk/Jabber: [EMAIL PROTECTED] > Linux User #114432 Hi, in listen project Makefile is shown how to make this thing. URL for SVN view of Makefile for listen 0.4.3 is: http://svn.sourceforge.net/viewvc/listengnome/releases/0.4.x/0.4.3/Makefile?view=markup Cheers, Pavel -- http://mail.python.org/mailman/listinfo/python-list

tkinter, livewires: slow moving on Canvas

2006-08-14 Thread Pavel Kosina
-- geon Pavel Kosina from livewires import * from random import randint def makePlayer(): global player_body, player_x, player_y player_x=randint(0,640) player_y=randint(0,480) player_body=circle(player_x, player_y,5, filled=1) def movePlayer(): global finito, player_body

Re: how to write special value to a config file with ConfigParser

2006-04-23 Thread pavel . starek
Hi, I have tried this: import ConfigParser fp = file("test.conf","w+") cp = ConfigParser.ConfigParser() cp.add_section("Section1") cp.set("Section1","Value1",12345) cp.write(fp) and works fine for me. -- http://mail.python.org/mailman/listinfo/python-list