Job opportunity for Python developer in Moscow, Russia

2008-06-07 Thread Denis S. Otkidach
We are looking for Python experts with strong knowledge of web technologies, RDBMS, UNIX, object-oriented development. Experience in django, sqlalchemy, CORBA, memcached, jquery and development of scalable high-prefomance applications is a plus. Compensation is above the market. If you are interes

Re: python commmand line params from c++

2005-06-30 Thread Denis S. Otkidach
me error. I believe it's due to PyFile_FromString failing to open non-existent file. You must check return value of it. -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: Embedding Python - Deleting a class instance

2005-06-21 Thread Denis S. Otkidach
ot going to use it anymore. > I've noticed that the PyObject returned by PyInstance_New has refcount = 2, > does this have any significance? The code below prints 1: PyObject *obj = PyInstance_New(PyExc_Exception, 0, 0); std::cerr << obj->ob_refcnt << "\n&qu

Re: Embedding Python - How to create a class instance

2005-06-20 Thread Denis S. Otkidach
a"); > dict = PyModule_GetDict(module); > A = PyDict_GetItemString(dict, "A"); > /* FIXME: Create obj as instance of A (a = A()) */ > obj = ??? obj = PyObject_CallObject(A, NULL); > > foo = PyObject_GetAttrString(obj, "foo"); > args = Py_

Static (why?) PyDateTimeAPI and SIP

2005-06-18 Thread Denis S. Otkidach
used %End %PostInitialisationCode PyDateTime_IMPORT; %End But I wonder why PyDateTimeAPI is declared static, and is the a better solution? -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: How to right align IPaddress?

2005-06-17 Thread Denis S. Otkidach
t output > eg 203.199.200.0 > 203.33.20.0 >>> for ip in ('203.199.200.0', '203.33.20.0'): ... print '%15s' % ip ... 203.199.200.0 203.33.20.0 >>> for ip in ('203.199.200.0', '203.33.20.0'): ... print ip

Re: translating C++ exceptions to python

2005-06-14 Thread Denis S. Otkidach
YouExceptionClass = PyErr_NewException("YourModule.YourException", 0, 0); 2. Add it to module dictionary. 3. In wrapper for my_cpp_function use something like the following code: try { my_cpp_function_impl(); } catch (YouException &exc) { PyErr_SetString(YouExceptionClass, exc

Re: urllib2 file upload error

2005-04-28 Thread Denis S. Otkidach
gument 1 must be string or read-only buffer, T> not list Exactly as error message states: the second argument to Request must be string, not list. You have to encode the body manually. T> Tried the script from T> http://fabien.seisen.org/python/urllib2_multipart.html T> also T> Gett

Re: Can an object of a C type have random members added? tp_dictoffset?

2005-04-21 Thread Denis S. Otkidach
Py_DECREF(obj); return NULL; } PyObject_GC_Track(obj); return (PyObject *)obj; } PyTypeObject Your_Type = { PyObject_HEAD_INIT(&PyType_Type) # ...skipped... offsetof(YourObject, dict), /* tp_dictoffset */ # ...skipped... } -- D

Re: deprecation of has_key?

2005-04-21 Thread Denis S. Otkidach
se "item in dict" because it's quite readable to me, SB> and generally faster. For me dictionary is a collection of key-value pairs, but not a collection of keys (that's what set is). -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: deprecation of has_key?

2005-04-21 Thread Denis S. Otkidach
quot; and "for item in dict") are related of course, since the following should pass: for item in d: assert item in d That's the reason why I always prefer to use has_key() and iteritems() to in and iter(). Readability counts. -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: PIL

2005-03-31 Thread Denis S. Otkidach
t clear. I had similar problems and solved them using some tricks with image.info['transparency'] and image.palette. Unfortunately I can't find this example, so if you succeed please post solution here. -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: embedded python example: PyString_FromString doesnt work?

2005-03-25 Thread Denis S. Otkidach
ok for modules in this directory. See http://python.org/doc/current/api/embedding.html#l2h-40 -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: need help with nullmailer-inject in python cgi script to send attachements ?

2005-03-24 Thread Denis S. Otkidach
t encode_base64 encode_base64(attachment) msg.attach(attachment) # using popen is unsafe if we can't trust fromaddr, using subprocess from subprocess import Popen, PIPE mailfl = Popen(['/usr/bin/nullmailer-inject', '-f', fromaddr], stdin=PIPE) mailfl.stdin.write(msg.as_string()) mailfl.stdin.close() mailfl.wait() -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: setattr inside a module

2005-03-23 Thread Denis S. Otkidach
de the module spam itself, what I've to K> pass to setattr as first argument? globals()[name] = value or setattr(__import__(__name__), name, value) # note, circular import here -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: Pre-PEP: Dictionary accumulator methods

2005-03-19 Thread Denis S. Otkidach
default=v) alternative? Not sure whether it's good idea to overload get() method, just an idea. -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: bsddb for k, v in db.items(): do order the numbers ?

2005-03-02 Thread Denis S. Otkidach
For positive integers you can pack keys with struct.pack('>I', value). -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: re.compile and very specific searches

2005-02-19 Thread Denis S. Otkidach
999.999.999 (something which could not > possibly be an IPv4 address). Can re.compile be configured to filter > results like this out? Try this one: re.compile(r'\b%s\b' % r'\.'.join(['(?:(?:2[0-4]|1\d|[1-9])?\d|25[0-5])']*4)) -- Denis S. Otkidach http://www.p

Re: Is it possible to use the logging-module in a threadless environment?

2005-02-17 Thread Denis S. Otkidach
logging/config.py to > something like: > > import dummy_thread as thread, dummy_threading as threading I believe it's a bug and logging/config.py should use the same approach as logging/__init__.py do: try: import thread import threading except ImportError: thread

Re: sre is broken in SuSE 9.2

2005-02-12 Thread Denis S. Otkidach
most distributions: >>> for c in u'\xb5\xba\xe4\u0430': print c.isalpha(), ... True True True True And in SuSE 9.2: >>> for c in u'\xb5\xba\xe4\u0430': print c.isalpha(), ... False False False False -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: sre is broken in SuSE 9.2

2005-02-12 Thread Denis S. Otkidach
be shipped as "python"). You are right. But isalpha behavior looks strange for me anyway: why cyrillic character '\u0430' is recognized as alpha one for de_DE locale, but is not for C? -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: sre is broken in SuSE 9.2

2005-02-11 Thread Denis S. Otkidach
hon test_re.py doesn't pass. $LANG doesn't matter if I don't call setlocale. Fortunately setting any non-C locale solves the problem for all (I believe) unicode character: >>> re.compile(ur'\w+', re.U).findall(u'\xb5\xba\xe4\u0430') [u'\xb5\xba

Re: sre is broken in SuSE 9.2

2005-02-10 Thread Denis S. Otkidach
: http://www.suse.de/feedback URL : http://www.python.org/ Summary : Python Interpreter BTW, where have they found something with Artistic License in Python? -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: sre is broken in SuSE 9.2

2005-02-10 Thread Denis S. Otkidach
On Thu, 10 Feb 2005 16:23:09 +0100 Daniel Dittmar <[EMAIL PROTECTED]> wrote: > Denis S. Otkidach wrote: > > > On all platfroms \w matches all unicode letters when used with flag > > re.UNICODE, but this doesn't work on SuSE 9.2: > > I think Python on SuSE 9.

Re: sre is broken in SuSE 9.2

2005-02-10 Thread Denis S. Otkidach
E' >>> re.compile(ur'\w+', re.U).match(u'\xe4') <_sre.SRE_Match object at 0x40375560> But I see nothing related to implicit re.L option in their patches and the sources themselves are the same as on other platforms. I'd prefer to find the source of problem. -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: sre is broken in SuSE 9.2

2005-02-10 Thread Denis S. Otkidach
On Thu, 10 Feb 2005 13:00:42 +0300 "Denis S. Otkidach" <[EMAIL PROTECTED]> wrote: > On all platfroms \w matches all unicode letters when used with flag > re.UNICODE, but this doesn't work on SuSE 9.2: > > Python 2.3.4 (#1, Dec 17 2004, 19:56:48) > [GCC 3

sre is broken in SuSE 9.2

2005-02-10 Thread Denis S. Otkidach
x27;ve looked through all SuSE patches applied, but found nothing related. What is the reason for broken behavior? Incorrect configure options? -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: need help on generator...

2005-01-21 Thread Denis S. Otkidach
>>> def consecutive_sets(l): ... for i in xrange(2, len(l)): ... for j in xrange(0, len(l)-i+1): ... yield l[j:j+i] ... >>> list(consecutive_sets([1,2,3,4])) [[1, 2], [2, 3], [3, 4], [1, 2, 3], [2, 3, 4]] -- Denis S. Otkidach http://www.python.ru/ [ru] --

Re: Python.org, Website of Satan

2005-01-14 Thread Denis S. Otkidach
x(0, (666-255*2)-a), 256): for c in xrange(max(0, (666-255)-a-b), min(666-a-b+1, 256)): d = 666-a-b-c ... I've checked these IPs with ip2cc (which can miss entries registered last month): there are 2907248 "evil" addresses, most of them (1568430) in U

Re: os.spawnv & stdin trouble

2005-01-12 Thread Denis S. Otkidach
ng parameters via shell (shell=True), than just use os.system. Nevertheless below is correct example of subprocess usage with stdout redirected to file: out_fp = open('wall0.TRANS.rad', 'wb') subprocess.call(['c:\\Radiance\\bin\\xform.exe', '

Re: os.spawnv & stdin trouble

2005-01-11 Thread Denis S. Otkidach
v(os.P_WAIT, path, ('xform', args)) This corresponds to c:\Radiancein\ '-t 0 8 0' wall0.rad '>' wall0.TRANS.rad' command line. > here's the cmd error message: > xform: cannot find file ">" Don't understand how you got t

Re: os.path.islink()

2005-01-01 Thread Denis S. Otkidach
On Wed, 08 Dec 2004 20:42:09 +1000 "Egor Bolonev" <[EMAIL PROTECTED]> wrote: > i want to detect "'s" Junctions are just mount points, not symbolic links. Dunno how to detect them in Windows. http://support.microsoft.com/default.aspx?scid=kb;en-us;

Re: DB-API format string conventions

2004-12-28 Thread Denis S. Otkidach
styles a given > API supports. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/278612 -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: Execute code after death of all child processes - (corrected posting)

2004-12-28 Thread Denis S. Otkidach
ion. The proper way is: try: while True: os.waitpid(-1, 0) except OSError, exc: if exc.errno!=errno.ECHILD: raise -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: MySQLdb blob and binary data

2004-12-10 Thread Denis S. Otkidach
zip import GzipFile from cStringIO import StringIO GzipFile(fileobj=StringIO(data)).read() -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list

Re: Unknown locale nb_NO ?

2004-12-07 Thread Denis S. Otkidach
( Is it valid? Have you tried "locale -a | grep nb_NO"? -- Denis S. Otkidach http://www.python.ru/ [ru] -- http://mail.python.org/mailman/listinfo/python-list