On 05/16/2010 02:38 PM, Alister wrote:
On Sun, 16 May 2010 12:07:08 +0300, Tuomas Vesterinen wrote:
I am testing an application GUI with Python 2.4, 2.5 and 2.6. The native
Python (in Fedora 12) is 2.6. Versions 2.4 and 2.5 are alt-installed.
Aplication GUI uses:
import pygtk
pygtk.require
On 05/16/2010 05:04 PM, Dave Angel wrote:
(You forgot to include the python-list in your response. So it only
went to me. Normally, you just do reply-all to the message)
mannu jha wrote:
On Sun, 16 May 2010 13:52:31 +0530 wrote
mannu jha wrote:
Hi,
I have few files like this:
file1:
22
ocal/lib/python2.4/site-packages/gtk-2.0/glib/__init__.py", line
22, in ?
from glib._glib import *
ImportError: /usr/lib/libpyglib-2.0-python.so.0: undefined symbol:
_PyObject_CallFunction_SizeT
What I should say more to get access to the GTK?
Tuomas Vesterinen
--
http://mail.python.org/mailman/listinfo/python-list
Mike Driscoll wrote:
On Dec 4, 5:28 am, Tuomas Vesterinen wrote:
If I want to open a html-page from Python code I can say:
>>> import webbrowser
>>> webbrowser.open('index.html')
Is there a standard way to init an email in users preferred email client
lik
If I want to open a html-page from Python code I can say:
>>> import webbrowser
>>> webbrowser.open('index.html')
Is there a standard way to init an email in users preferred email client
like Thubderbird, Evolution etc.?
Tuomas Vesterinen
--
http://mail.python
Tinybooker 0.2.2 released at http://tinybooker.org/
Tinybooker is an accounting program offering the dual accounting
core functionality for moderate size accountings:
* Assisted establishing new accountings
* Localized scheme templates
* Easy entering and saving new entries
* Sta
Roger Binns wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Tuomas Vesterinen wrote:
I am intensively using 2to3.py. So I have 2 codebase: one in py2 and the
other in py3.
The expectation would be that you only maintain the py2 code and
automatically generate the py3 code on demand
R. David Murray wrote:
Tuomas Vesterinen wrote:
I am developing a Python application as a Python2.x and Python3.0
version. A common code base would make the work easier. So I thought to
try a preprosessor. GNU cpp handles this kind of code correct:
#ifdef python2
print u'foo
Kless wrote:
Is there any way of to get the class name to avoid to have that write
it?
---
class Foo:
super(Foo, self)
---
* Using Py 2.6.2
>>> class Foo(object):
... def cls(self):
... return self.__class__
...
>>> Foo().cls()
--
http://mail.python.or
Peter Otten wrote:
Tuomas Vesterinen wrote:
I am developing a Python application as a Python2.x and Python3.0
version. A common code base would make the work easier. So I thought to
try a preprosessor. GNU cpp handles this kind of code correct:
Any other suggestions?
http
'foo', 'bar')
#endif
results:
> cpp -E -Dpython2 test_cpp.py
...
print u'foo', u'bar'
Any other suggestions?
Tuomas Vesterinen
--
http://mail.python.org/mailman/listinfo/python-list
Thanks. Bug report done, issue 6093.
Tuomas Vesterinen
Gabriel Genellina wrote:
En Fri, 22 May 2009 06:32:40 -0300, Tuomas Vesterinen
escribió:
This was fixed once in Python 2.5, but in Python 3.0 the bug
celebrates its comeback. The tail of the strxfrm result is ambiguous.
Python 3.0.1
ts" or "license" for more information.
>>> import locale
>>> locale.setlocale(locale.LC_COLLATE, 'en_US.utf8')
'en_US.utf8'
>>> key1=locale.strxfrm('maupassant guy')
>>>> for i in range(10):
... print(locale.strxf
Nick Craig-Wood wrote:
Tuomas Vesterinen wrote:
I hoped that I could get rid of my special module _strptime2 when
porting to Python 3.0. But testing is a disappointment.
[snip]
C :
strftime('%a %b %e %H:%M:%S %Y')='Sat May 9 11:26:12 2009'
strptime('Sat
r %Z'
strftime('%m/%d/%Y')='05/09/2009'
strptime('05/09/2009','%m/%d/%Y')=
2009-05-09 00:00:00
strftime('%r')='11:26:12 AM'
strptime('11:26:12 AM','%r')=
'r' is a bad directi
Mark Summerfield wrote:
> I feel that Python lacks one useful data structure: an ordered
> dictionary.
Why it should be a dict. With it you can only maintain the order
x1http://mail.python.org/mailman/listinfo/python-list
To save your time:
http://ilikeit.desiblogz.com/363/ojofuffo,+ojofuffo,+ojofuffo+-+Solutions+to+the+Hacking+puzzle++by+freestuffhotdeals.com.html
Renu wrote:
> Hi,
>
> Just click on this link n use ur common sence to navigate.
>
> It has 23 pages one after the other, starting from this first
>
uffer is resized, and strxfrm is called
> again. That's a rather common sequence when buffer sizes are not known
> in advance.
> [Note that `dest` is indeterminate, NOT the function return value which
> always returns the required buffer size]
>
OK, I made too quick conclusions of the man text without knowing the
details.
Tuomas
--
http://mail.python.org/mailman/listinfo/python-list
ter and I should kick
strxfrm off and take strcoll instead. It costs converting the seach key
in every step of the search.
Tuomas
> Peter
--
http://mail.python.org/mailman/listinfo/python-list
Gabriel Genellina wrote:
> En Tue, 04 Sep 2007 07:34:54 -0300, Tuomas
> <[EMAIL PROTECTED]> escribi�:
>
>> Python 2.4.3 (#3, Jun 4 2006, 09:19:30)
>> [GCC 4.0.0 20050519 (Red Hat 4.0.0-8)] on linux2
>> Type "help", "copyright", "credits
gt;> re.compile('(\+{0,1})?([0-9]+)').findall('879+34343')
[('', '879'), ('+', '34343')]
Tuomas Vesterinen
--
http://mail.python.org/mailman/listinfo/python-list
Python 2.4.3 (#3, Jun 4 2006, 09:19:30)
[GCC 4.0.0 20050519 (Red Hat 4.0.0-8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> def key(s):
... locale.setlocale(locale.LC_COLLATE, 'en_US.utf8')
... return locale.strxfrm(s.encode('utf8
>>> records = [['dog',1,2], ['chair',2,1], ['cat',1,3], ['horse',3,4],
... ['table',3,2], ['window',3,5]]
>>> sorted(records, key = lambda x: (x[1], x[2]))
[['dog', 1, 2], ['cat', 1, 3], ['chair', 2, 1], ['table', 3, 2],
['horse', 3, 4], ['window', 3, 5]]
[EMAIL PROTECTED] wrote:
> Hi,
>
> i
#!/usr/bin/python
# module show_my_path
# ...
import os
print 'os.path.abspath(__file__):', os.path.abspath(__file__)
# ...
# end of module
[EMAIL PROTECTED] class]$ python
>>> import show_my_path
os.path.abspath(__file__): /misc/proc/py/test/class/show_my_path.py
>>>
[EMAIL PROTECTED] class]$ p
ok = excepthook
>>> class UserError(StandardError):
... def __str__(self):
... return self.args[0]
...
>>> raise UserError(u'Väärä tyyppi')
Traceback (most recent call last):
File "", line 1, in ?
UserError: Väärä tyyppi
>>>
Tuomas
Tuomas
This works:
>>> raise StandardError(u'Wrong type')
Traceback (most recent call last):
File "", line 1, in ?
StandardError: Wrong type
but don't in Finnish:
>>> raise StandardError(u'Väärä tyyppi')
Traceback (most recent call last):
File "", line 1, in ?
StandardError>>>
>>>
Any solution
[EMAIL PROTECTED] wrote:
> Hello,
>
> I was trying to create a flattened list of dictionary values where each
> value is a list, and I was hoping to do this in some neat functionally
> style, in some brief, throwaway line so that it would assume the
> insignificance that it deserves in the grand s
Steven D'Aprano wrote:
> On Mon, 06 Nov 2006 13:03:55 +, Tuomas wrote:
>
>
>>If you read the whole chain you find out what we were talking of.
>
>
> I had already read the whole thread, and I've read it again in case I
> missed something the first t
Steve Holden wrote:
> Suppose you did actually want to do this you have chosen about the worst
> possible way: the use of global variables to condition function
> execution is a sure way to get into trouble. Consider if somebody else
> want to use your function: they also have to set a global in
Steven D'Aprano wrote:
> On Sun, 05 Nov 2006 19:35:58 +, Tuomas wrote:
>
>
>>Thanks. My solution became:
>>
>> >>> def flattern(arg):
>>... result = []
>>... for item in arg:
>>... if isinstance(item, (l
Dennis Lee Bieber wrote:
> On Sun, 05 Nov 2006 22:51:00 GMT, Tuomas <[EMAIL PROTECTED]>
> declaimed the following in comp.lang.python:
>
>
>>>
>>
>>I fylly agree with tis: "Typically, the responsibility should be on the
>>CALLER, not the C
Dennis Lee Bieber wrote:
> On Sun, 05 Nov 2006 17:42:30 GMT, Tuomas <[EMAIL PROTECTED]>
> declaimed the following in comp.lang.python:
>
>
>
>>I am looking a shorter way to do the above in the case:
>>
>>def g(*arg):
>> return arg
>>
>
Stargaming wrote:
> Either you take one of the snippets here:
> http://aspn.activestate.com/ASPN/search?query=flatten§ion=PYTHONCKBK&type=Subsection
>
>
> or just use arg[0] clever (as mentioned a few times in this thread).
Thanks. My solution became:
>>> def flattern(arg):
... result = [
Tuomas wrote:
> def g(*arg):
> return arg
>
> def f(*arg):
> return g(arg)
>
> How can g know if it is called directly with (('foo', 'bar'),) or via f
> with ('foo', 'bar'). I coud write in f: return g(arg[0], arg[1]) if
Steven D'Aprano wrote:
> You could write something like this:
>
> def g(*arg):
> # Detect the special case of a single tuple argument
> if len(arg) == 1 and type(arg[0]) == tuple:
> return arg[0]
> else:
> return arg
>
> but now tuple arguments are treated differently
Diez B. Roggisch wrote:
> Tuomas schrieb:
>
>> >>> def g(*arg):
>> ... return arg
>> ...
>> >>> g('foo', 'bar')
>> ('foo', 'bar')
>> >>> # seems reasonable
>> ...
>&g
>>> def g(*arg):
... return arg
...
>>> g('foo', 'bar')
('foo', 'bar')
>>> # seems reasonable
...
>>> g(g('foo', 'bar'))
(('foo', 'bar'),)
>>> # not so good, what g should return to get rid of the outer tuple
TV
--
http://mail.python.org/mailman/listinfo/python-list
Try
a=(b+c)/NumX(2)
TV
Anton81 wrote:
> Hello!
>
> I wrote a class
>
> class NumX:
> ...
> def __add__(self,other):
> ...
> def __div__(self,other):
> if not isinstance(other,NumX): other=NumX(other)
> ...
>
> Somewhere else I use
>
> a=(b+c)/2
>
> where all variables are
#!/usr/bin/python
"""test pydev_0.9.3/../pylint"""
__revision__ = "test_mod 0.1 by TV 06/10/22"
lst = ['aaa', ' bbb', '\tccc\n']
lst = map(lambda x: x.strip(), lst)
result = """
No config file found, using default configuration
* Module test_mod
W: 6: Used builtin function 'map'
E:
Georg Brandl wrote:
> Some people think that all occurences of map() must be replaced
> by list comprehensions. The designer of pylint seems to be
> one of those.
So it seems, but why? Formally spoken we ase "using variable 'x' before
assigment" in the comprehension too.
#!/usr/bin/python
"""tes
tom arnall wrote:
> Is there a cross-linked version of the python documentation available? Is
> anyone interested in starting a project for such?
>
> tom arnall
> north spit, ca
> usa
>
pydoc serves as such a cross-linked version of the python *online*
documentation
TV
--
http://mail.python.o
My application needs to handle different language sorts. Do you know a
way to apply strxfrm dynamically i.e. without setting the locale?
Tuomas
Neil Cerutti wrote:
> On 2006-10-16, Ron Adam <[EMAIL PROTECTED]> wrote:
>
>>I have several applications where I want to sort lists
the context;
they are not modified. The locals are currently unused. The fromlist
should be a list of names to emulate ``from name import ...'', or an
empty list to emulate ``import name''.
When importing a module from a package, note that __import__('A.B', ...)
returns package A when fromlist is empty, but its submodule B when
fromlist is not empty.
Tuomas
--
http://mail.python.org/mailman/listinfo/python-list
e <= end_point:
try:
do_complex_computation(case)
except Exception:
print case
break
If you get an error you repair the program and set
start_point=case
and go on with the program.
Tuomas
--
http://mail.python.org/mailman/listinfo/python-list
MonkeeSage wrote:
> Tuomas wrote:
>
>>Yes, I read the reference before posting here. I tried something like:
>
>
> Hi Tuomas,
>
> I didn't mean to say that you hadn't read the docs (I had a hard time
> finding the right methods in the docs too, even tho
MonkeeSage wrote:
> Tuomas wrote:
>
>>I would like to manipulate PyGTK Entry widget's background and
>>foreground colors. Is it possible? How?
>
>
> Yes, it is possible:
>
> # widget color
> entry.modify_base(gtk.STATE_NORMAL, gtk.gdk.color_parse(&quo
I would like to manipulate PyGTK Entry widget's background and
foreground colors. Is it possible? How?
Tuomas
--
http://mail.python.org/mailman/listinfo/python-list
_lines-1) k has the same value and k+1
owerflows the list index range.
Try
for j in range(1, no_lines):
...
if list_initial[k-1] < list_initial[k]:
...
Tuomas
> temp_str = list_initial[k]
> elif list_initial[k] == list_initial[k+1]:
>
# My second trial was to include self.grab_focus() before
# show_message, but it gives focus to the toplevel
# gtk.gdk.Window and I lose access to the entry.
# Any suggestions?
# Tuomas Vesterinen
--
http://mail.python.org/mailman/listinfo/python-list
Pontus Ekberg wrote:
> You are probably looking for "configure_event".
That's it! Works fine, thanks.
Tuomas
--
http://mail.python.org/mailman/listinfo/python-list
From a PyGTK component I would like to react moving and resizing the
toplevel window. I try to connect the toplevel 'frame-event' to my
callback, but the toplevel do not fire on moving or resizing. Any
suggestions?
Tuomas
(Linux, Python 2.3, GTK 2.6.7)
--
http://mail.python.o
51 matches
Mail list logo