[issue25084] remove semi-busy loop in py2.7 threading.Condition.wait(timeout=x)

2015-09-19 Thread Flavio Grossi
Flavio Grossi added the comment: > About the new optional balanced parameter added downstream to Fedora, the > patch is very small compared to timedlock.patch. It only changes the Python > code, not the C code The balancing fix has 3 main problems imo: - It causes long delays t

[issue25084] remove semi-busy loop in py2.7 threading.Condition.wait(timeout=x)

2015-09-15 Thread Flavio Grossi
Flavio Grossi added the comment: First of all, thank you for your support. I fully understand what you are saying, however, being stuck to python 2.7 because of libraries still not ported to 3, this is a serious problem to us, and, while i agree this would introduce a new "feature"

[issue25084] remove semi-busy loop in py2.7 threading.Condition.wait(timeout=x)

2015-09-15 Thread Flavio Grossi
Flavio Grossi added the comment: >> however, being stuck to python 2.7 because of libraries > Are there private libraries or public libraries? It is a mix of public and internal libraries with the main public blockers being twisted and apache thrift (and other libs which have py3 alt

[issue25084] remove semi-busy loop in py2.7 threading.Condition.wait(timeout=x)

2015-09-13 Thread Flavio Grossi
New submission from Flavio Grossi: threading.Condition.wait(timeout=x) is implemented in python 2 as a semi-busy loop which causes cpu wakeups and unexpected cpu use. I think this is somewhat problematic since it causes problems in all modules which use that method, such as Queue.get() when

[issue22666] email.Header no encoding of unicode strings containing newlines

2014-11-27 Thread Flavio Grossi
Flavio Grossi added the comment: Hi, and thank you for your answer. However this is not strictly related to the newline, but also to some small idiosyncrasies and different behavior among py2 and py3 (and even in py2 using Header() or Charset()): # py2.7, non-unicode str H('test', 'utf-8

[issue22666] email.Header no encoding of unicode strings containing newlines

2014-11-26 Thread Flavio Grossi
Flavio Grossi added the comment: any news? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22666 ___ ___ Python-bugs-list mailing list

[issue22666] email.Header no encoding of unicode strings containing newlines

2014-10-18 Thread Flavio Grossi
New submission from Flavio Grossi: When trying to encode an email header with a newline in it, correct encoding is done only for strings and not for unicode strings. In fact, for unicode strings, encoding is only done if a non ascii character is contained in it. The attached patch should fix

what should we use instead of the 'new' module?

2008-11-12 Thread Flavio
How is this code going to look like in Python 3.0? (it's deprecated according to http://docs.python.org/library/new.html#module-new, but it does not tell what to use instead) method = new.instancemethod(raw_func, None, cls) setattr(cls, name, method) Can we write code in python2.5/2.6 that

ZODB List

2007-12-09 Thread Flavio
Hi, I am a big fan of ZODB and use it stand alone on many project of mine. One of the things I miss is a community around it. I don't care much about ZOPE (though I admire it) and have not being able to find a ZODB focused community. Is there one? thanks --

Threads and racing conditions

2007-08-21 Thread Flavio Preto
. Is it possible that in a read, the method return a value that is not an old or a new value? In other words, is it possible that a 'read' return (due to a 'write' at the same time by another thread) an invalid value that was never supposed to be there? Thanks, Flavio Preto -- http://mail.python.org

boolean operations on sets

2007-08-06 Thread Flavio
Hi, I have been playing with set operations lately and came across a kind of surprising result given that it is not mentioned in the standard Python tutorial: with python sets, intersections and unions are supposed to be done like this: In [7]:set('casa') set('porca') Out[7]:set(['a', 'c'])

Re: preferred windows text editor?

2007-05-10 Thread Flavio Preto
I use VIM here too. Mainly because i always switch from Windows to Linux and using the same text editor is a way to avoid getting crazy. []'s Preto On 9 May 2007 15:21:41 -0700, BartlebyScrivener [EMAIL PROTECTED] wrote: On May 9, 1:26 pm, Looney, James B [EMAIL PROTECTED] wrote: I'm using

Re: Newbie prob: How to write a file with 3 threads?

2007-05-06 Thread Flavio Preto
Is it not possible to acomplish this with a token-based algorithm? With 3 Threads: A, B and C Thread A start with Token. Thread with the token writes the byte and send the token to the next Or python has any issues to a file object shared among a few threads? []'s Flavio On 5/6/07, Marc

PyGTK and Window Size

2007-05-03 Thread Flavio Preto
). The trivial solution that i've imagined is to save to a config file the current status of the window, but i wish that PyGTK automatic handled this for me. Thanks, Flavio -- http://mail.python.org/mailman/listinfo/python-list

plugin development best practices

2007-02-22 Thread Flavio
Hi, Nowadays the addition of functionality to programs by means of plugins is very frequent. I want to know the opinions of experienced Python developers about the best practices when it comes to developing a plugin system for a Python package. Should plugins be modules in a separate package?

Re: is it possible to remove the ':' symbol in the end of lines starting with 'if', 'while' etc?

2007-02-22 Thread Flavio
On Feb 22, 9:49 am, [EMAIL PROTECTED] wrote: I don't know to which forum should I post the message I hope someone related to the Python kernel development will read consider the idea I'm (a former? meanwhile not sure) MATLAB user it's very annoing typing each time for example while i:

Re: plugin development best practices

2007-02-22 Thread Flavio
On Feb 22, 11:00 am, Diez B. Roggisch [EMAIL PROTECTED] wrote: Flavio wrote: Hi, Nowadays the addition of functionality to programs by means of plugins is very frequent. I want to know the opinions of experienced Python developers about the best practices when it comes to developing

Re: plugin development best practices

2007-02-22 Thread Flavio
On Feb 22, 11:01 am, Jean-Paul Calderone [EMAIL PROTECTED] wrote: On 22 Feb 2007 04:53:02 -0800, Flavio [EMAIL PROTECTED] wrote: Hi, Nowadays the addition of functionality to programs by means of plugins is very frequent. I want to know the opinions of experienced Python developers about

Re: plugin development best practices

2007-02-22 Thread Flavio
On Feb 22, 10:53 am, Flavio [EMAIL PROTECTED] wrote: Hi, Nowadays the addition of functionality to programs by means of plugins is very frequent. I want to know the opinions of experienced Python developers about the best practices when it comes to developing apluginsystemfor a Python

Re: plugin development best practices

2007-02-22 Thread Flavio
On Feb 22, 12:36 pm, Diez B. Roggisch [EMAIL PROTECTED] wrote: Simple plugin system proposal: have a package (directory with __init__.py) called plugins where the actual plugins are modules in this directory. When the main script imports the plugins package, all plugin modules would be

Re: plugin development best practices

2007-02-22 Thread Flavio
On Feb 22, 12:51 pm, Flavio [EMAIL PROTECTED] wrote: On Feb 22, 12:36 pm, Diez B. Roggisch [EMAIL PROTECTED] wrote: Simple plugin system proposal: have a package (directory with __init__.py) called plugins where the actual plugins are modules in this directory. When the main

Re: plugin development best practices

2007-02-22 Thread Flavio
On Feb 22, 2:04 pm, Paul Boddie [EMAIL PROTECTED] wrote: On 22 Feb, 16:13, Diez B. Roggisch [EMAIL PROTECTED] wrote: Darn. You're right of course - I just got the basic idea, and formed in my mind the get the modules filename, thus the path, glob over it for *py, and thus get the

gdesklets question: import problem

2007-02-01 Thread Flavio
Hi, sorry for posting here, but the forum in the projects page is not working. Maybe there is a gdesklet developer lurking... :-) I cant import anything from a script, it gives me a runtime error. is this a bug or a feature? without being able to import from python standard library or other

Re: raise UnicodeError, label too long

2007-01-25 Thread Flavio
this obvious bug. On Jan 25, 4:39 am, Dennis Lee Bieber [EMAIL PROTECTED] wrote: On 24 Jan 2007 16:25:19 -0800, Flavio [EMAIL PROTECTED] declaimed the following in comp.lang.python: something like this, for instance: http://.wikipedia.org/wiki/Copper%28II%29_hydroxideWas there some

raise UnicodeError, label too long

2007-01-24 Thread Flavio
Hi I am havin a problem with urllib2.urlopen. I get this error when I try to pass a unicode to it. raise UnicodeError, label too long is this problem avoidable? no browser or programs such as wget seem to have a problem with these strings. --

Re: raise UnicodeError, label too long

2007-01-24 Thread Flavio
. This is bad, since some links do contain strings with non-ascii characters. thanks, Flávio Marc 'BlackJack' Rintsch escreveu: In [EMAIL PROTECTED], Flavio wrote: Hi I am havin a problem with urllib2.urlopen. I get this error when I try to pass a unicode to it. raise UnicodeError, label

Re: raise UnicodeError, label too long

2007-01-24 Thread Flavio
UnicodeError, label too long UnicodeError: label too long very strange, because I tried other unicode urls from the python console like this urllib2.urlopen(u'www.google.com') and it works normally: Martin v. Löwis escreveu: Flavio schrieb: What I am doing is very simple: I fetch an url

Re: f2py on windows tutorials

2006-09-27 Thread Flavio
Ok, I tried that and it seems we are making progress so here is my command: python setup.py build_ext --compiler=mingw32 --fcompiler=gnu Now it is complaining about my pyf!! error: unknown file type '.pyf' here is my setup .py: import setuptools, os from numpy.distutils.core import setup,

Re: f2py on windows tutorials

2006-09-27 Thread Flavio
of mingw32 it does not work!! So all that remains now is to be able to do it from the setup.py... thanks again... Robert Kern wrote: Flavio wrote: Ok, I tried that and it seems we are making progress so here is my command: python setup.py build_ext --compiler=mingw32 --fcompiler=gnu

Re: f2py on windows tutorials

2006-09-27 Thread Flavio
! isn't this great? thanks for all the help you provided. I couldn't have done it without it. Cheers, Flávio Robert Kern wrote: Flavio wrote: Ok, I tried that and it seems we are making progress so here is my command: python setup.py build_ext --compiler=mingw32 --fcompiler=gnu Now

Re: f2py on windows tutorials

2006-09-26 Thread Flavio
is a setup.py tailored to compile an f2py extension on windows. Have you got one of these? if so please send it to me and I can certainly figure out the rest. thanks, Flavio Robert Kern wrote: Flavio wrote: Hello, Compiling f2py extensions in Linux is a trivial task, You can even

Re: f2py on windows tutorials

2006-09-26 Thread Flavio
SDK needs to be installed before building extensions for Python. any further help will be greatly appreciated... Thanks again, Flávio Robert Kern wrote: Flavio wrote: Its been a while since i Tried this and right now I have no access to a windows machine to try it and show you the error

f2py on windows tutorials

2006-09-23 Thread Flavio
Hello, Compiling f2py extensions in Linux is a trivial task, You can even automate it with distutils. Now, in a Windows machine this does not seem to be an easy task. At least, I could not find any decent tutorial on how to do it. Is there a way to do this? Can some one point me to a tutorial.,

Re: xmingw and f2py

2006-09-08 Thread Flavio
wrote: Flavio [EMAIL PROTECTED] wrote: has anyone tried to build extensions for win32 on Linux using xmingw? I don't know about xmingw, but we use mingw on linux to compile stuff for windows all the time. (We use the mingw package under debian) We build extensions using mingw but linked

Re: xmingw and f2py

2006-09-08 Thread Flavio
/tmpIkxhAr/src.linux-i686-2.4 adding '/tmp/tmpIkxhAr/src.linux-i686-2.4/flib-f2pywrappers.f' to sources. running build_ext error: don't know how to compile C/C++ code on platform 'posix' with '/opt/xmingw/bin/i386-mingw32msvc-gcc' compiler any further suggestions? Nick Craig-Wood wrote: Flavio [EMAIL

xmingw and f2py

2006-09-07 Thread Flavio
Hi, has anyone tried to build extensions for win32 on Linux using xmingw? I need to use f2py to compile code for the win32 platform and I want to do this in Linux. I googled aroung but could not find any documentation on this. For those who dont know xmingw is a port to linux of mingw. any

Re: xmingw and f2py

2006-09-07 Thread Flavio
Flavio wrote: Hi, has anyone tried to build extensions for win32 on Linux using xmingw? I need to use f2py to compile code for the win32 platform and I want to do this in Linux. I googled aroung but could not find any documentation on this. For those who dont know xmingw is a port

can't destroy a wxMiniFrame

2006-08-24 Thread Flavio
of its previous incarnation... how can I completely destroy a miniframe? Flavio -- http://mail.python.org/mailman/listinfo/python-list

Re: can't destroy a wxMiniFrame

2006-08-24 Thread Flavio
It was human error... I found the bug... thanks, Laszlo Nagy wrote: Flavio írta: Hi, I have a miniframe composed mainly of combo boxes, that I need to destroy and recreate multiple time with different choice lists for the combo boxes. My problem is that even after destroying

Re: cx_freeze and matplotlib

2006-05-14 Thread Flavio
My application needs needs matplotlib. So cx_Freeze bundles it in. But it only bundles matplotlib python modules, not its data files! In the original machine I believe that the frozen executable is somehow finding those datafiles in their original locations, which is not desirable, ecause the

Re: distributing a app frozen by cx_freeze

2006-05-13 Thread Flavio
Thanks for the hint. I'll try to get cx_freeze to bundle up other shared libraries it may not be bundling such as qtcanvas, qtext, qtui, etc. and see if it works. I'll post back the results to help other poor souls like me. Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: distributing a app frozen by cx_freeze

2006-05-13 Thread Flavio
Well I managed to get rid of the undefined symbol message by copying all qt libs to the freeze directory, the problem is that now the package is huge (83MB)! So my question is: is there a way to find out exactly which lib is missing ? Thanks --

Re: distributing a app frozen by cx_freeze

2006-05-13 Thread Flavio
I know, but the whole point of cx_freeze is to generate standalone executables, so asking for an installation of an specific version of Qt is just a little better than asking the end user to install from source... -- http://mail.python.org/mailman/listinfo/python-list

cx_freeze and matplotlib

2006-05-13 Thread Flavio
I am trying to freeze an application which imports matplotlib. It all works fine on the machine where it was frozen. The executable runs without a glitch. But when I move the directory containing the frozen executable and other libs to a new machine, I get the following error: Traceback (most

distributing a app frozen by cx_freeze

2006-05-12 Thread Flavio
(most recent call last): File /home/fccoelho/Downloads/cx_Freeze-3.0.2/initscripts/Console.py, line 26, in ? File epigrass.py, line 4, in ? ImportError: /home/flavio/freeze/qt.so: undefined symbol: _ZNK9QSGIStyle9classNameEv It is looking for the Original cx_freeze installation!! Do I have

whats your favourite object relational mapper?

2006-03-19 Thread Flavio
With so many object relational mappers out there, I wonder which one is the preferred tool among the Pythonists... is there a favourite? Sqlobject, PyDO, SQLAlchemy, dejavu, etc... -- http://mail.python.org/mailman/listinfo/python-list

PyQt: QListView how to retrieve selected items?

2006-02-02 Thread Flavio
to that end. Any PyQt guru lurking around? should I try some other list widget, that has a getSelected()method? Is there one? any help will be appreciated. Flavio -- http://mail.python.org/mailman/listinfo/python-list

Re: PyQt: QListView how to retrieve selected items?

2006-02-02 Thread Flavio
Iterating over the items and checking if it is selected, sounds like a good idea, but there no obvious way to get a hold of the list of items!! The only way you can get an item is if you are in single selection mode and you call selectedItem(). But I have to use multiple selection mode, for which

Re: PyQt: QListView how to retrieve selected items?

2006-02-02 Thread Flavio
Who has created these items? Obviously you, so you _can_ store the list of selected items. well yeah, but the Idea was to let the user select(through the widget) a subset of the original list and then access that subset... Or you use the equally well documented QListViewItemIterator to

Re: importing a method

2005-11-28 Thread Flavio
Because, by the time the user function is imported and attributed to the custom method, soandso has already been instantiated and contains the information tha needs to accessed by the user's function. -- http://mail.python.org/mailman/listinfo/python-list

Re: importing a method

2005-11-28 Thread Flavio
If you read my original post, I had no intention of atributing the user's method to the class, but to the instance. Anyway I figure it out myself, and its quite a Pythonic solution: class Foo: name='John' a=Foo() def p(parent): self=parent print 'Hi,

Re: importing a method

2005-11-28 Thread Flavio
There only one puzzle left to solve: altough the solution I proposed works, this variant has problems: class Foo: name='John' a=Foo() def p(): print 'Hi, %s!'%self.name a.met=p a.met.self = a a.met() NameError: global name 'self' is not defined This error is

Re: importing a method

2005-11-28 Thread Flavio
This new module sounds pretty cool, too bad its deprecated... I would not want to add a dependancy to a deprecated module in my code. But maybe I'll check the code for instancemethod within it and see what it does. Flávio -- http://mail.python.org/mailman/listinfo/python-list

Re: importing a method

2005-11-28 Thread Flavio
Addendum to my last reply: although the New Method is deprecated, new.instancemethod (from Antoon's message) can be replaced by from types import MethodType f.show = MethodType(show,f) and every thing still works. -- http://mail.python.org/mailman/listinfo/python-list

Re: importing a method

2005-11-28 Thread Flavio
First of all,why do you think the new module is deprecated? (I can't find anything in the docs to indicate this.) Its in the docs of python 2.4. I dont know about older versions: Help on module new: NAME new - Create new objects of various types. Deprecated. FILE

Re: importing a method

2005-11-28 Thread Flavio
If you have a function f and want to make an instancemethod out of it, you can simply call f.__get__(theinstance, theclass) and that will build and return the new instancemethod you require. I think that f.show = MethodType(show,f) is less cryptic than f.__get__(instance, class) Flávio --

importing a method

2005-11-27 Thread Flavio
hi, I have an object defined with a number of hardcoded methods. Class soandso: def __init__(self): self.this = 0 self.that = 1 def meth1(self): ... def meth2(self): ... def custom(self): pass I want to allow the user to write a python

Re: updating local()

2005-10-06 Thread Flavio
Ok, I got it! Its vey insecure, and it is not guaranteed to work. Fine. Now what would you do if you wanted to pass a lot of variables (like a thousand) to a function and did not wanted the declare them in the function header? Flávio -- http://mail.python.org/mailman/listinfo/python-list

Re: updating local()

2005-10-06 Thread Flavio
I wish all my problems involved just a couple of variables, but unfortunately the real interesting problems tend to be complex... As a last resort this problem could be solved by something like this: def fun(**kw): a = 100 for k,v in kw.items(): exec('%s = %s'%(k,v)) print

Re: updating local()

2005-10-06 Thread Flavio
to have to refer to them as variables['whatever']... dont you think? Flavio -- http://mail.python.org/mailman/listinfo/python-list

updating local()

2005-10-05 Thread Flavio
Hi, I heard time and again that you are not _supposed_ to update the locals dictionary. Can anyone tell me why, if the following code works, I should not do this? # # Extending Local namespace # def fun(a=1,b=2,**args): print 'locals:',locals() locals().update(args)

circular iteration

2005-01-21 Thread Flavio codeco coelho
hi, is there a faster way to build a circular iterator in python that by doing this: c=['r','g','b','c','m','y','k'] for i in range(30): print c[i%len(c)] thanks, Flávio -- http://mail.python.org/mailman/listinfo/python-list

Re: Python serial data aquisition

2005-01-12 Thread Flavio codeco coelho
[EMAIL PROTECTED] (Flavio codeco coelho) wrote in message news:[EMAIL PROTECTED]... struct.unpack returns a tuple of values represented by a string(the output of the read command) packed according to the format specified by BB In this forma string, stands for big Endian representation and B

Re: Python serial data aquisition

2005-01-11 Thread Flavio codeco coelho
[EMAIL PROTECTED] (Michael Fuhr) wrote in message news:[EMAIL PROTECTED]... If the actual byte and/or bit order is different then you'll have to modify the expression, but this should at least give you ideas. Hi Michael, It all looks pretty god but there is a couple of things I still don't

Re: Python serial data aquisition

2005-01-11 Thread Flavio codeco coelho
than the one he used. Since hex numbers get me all confused (and python doesn't convert to binary), I was wondering which one is the correct masking... thnaks, Flavio -- http://mail.python.org/mailman/listinfo/python-list

Checking for X availability

2005-01-11 Thread Flavio codeco coelho
I have a program that uses pythondialog for its UI. Pythondialog is a wrapper of the shell dialog and xdialog libs. But I would like for it to switch between using Dialog ( when X is not available ) and xdialog (when X is available) So my question is: how can I check for the availability of X?

Re: Python serial data aquisition

2005-01-11 Thread Flavio codeco coelho
[EMAIL PROTECTED] (Bengt Richter) wrote in message news:[EMAIL PROTECTED]... On 9 Jan 2005 14:13:28 -0800, [EMAIL PROTECTED] (Flavio codeco coelho) wrote: Hi, I am using pyserial to acquire data from an A/D converter plugged to my serial port. my hardware represents analog voltages

Python serial data aquisition

2005-01-09 Thread Flavio codeco coelho
Hi, I am using pyserial to acquire data from an A/D converter plugged to my serial port. my hardware represents analog voltages as 12bit numbers. So, according to the manufacturer, this number will be stored in two bytes like this; |-bits(1-8)---| Byte1: x x x