received and acted upon, I
have -
event_waiting.set() # set event to True, which unblocks the gui thread
HTH
Frank Millman
--
http://mail.python.org/mailman/listinfo/python-list
Stephen Hansen wrote:
> On Wed, Dec 9, 2009 at 10:21 PM, Frank Millman wrote:
>
>> I also need to block events in my wxPython app, though the time duration
>> is
>> very short. I have a separate thread that sends notification of gui
>> events
>> to a server
Stephen Hansen wrote:
>
> Well if you have a legitimate case for pre-empting the event loop with
> these
> periodic regular short blocking moments (it seems you may), I think what
> you
> want to do is overwrite FilterEvent on your App object. You can then make
> that flag something you set on th
Frank Millman wrote:
>
> I am writing a multi-user business/accounting application. It is getting
> rather complex and I am looking at how to, not exactly simplify it, but
> find a way to manage the complexity.
>
[...]
>
> Is there any particular benefit in using remote
I think the assertion should be "isinstance(name,
basestring)" to prevent this from happening.
Is this worth reporting, if it has not been reported already?
Thanks
Frank Millman
--
http://mail.python.org/mailman/listinfo/python-list
"Aahz" wrote:
> Frank Millman wrote:
>>
>>Is this worth reporting, if it has not been reported already?
>
> Defiitely report it.
Thanks, Aahz.
I took the lack of responses to indicate that there was no reason *not* to
report it, so I reported it on 24th De
following traceback -
Traceback (most recent call last):
File "F:\junk\multiprocess\mp13b.py", line 29, in
acno = cust.add_column('Acno')
File "", line 2, in add_column
File "C:\Python26\lib\multiprocessing\managers.py"
tr('my_function'), my_function)
Is there any reason why __name__ cannot be a unicode object in Python 2.x?
If so, there is probably little chance of this being changed, so it is
probably not worth reporting.
Any thoughts?
Frank Millman
--
http://mail.python.org/mailman/listinfo/python-list
"Frank Millman" wrote in message
news:hieoq6$4i...@ger.gmane.org...
> Hi all
>
> This problem is similar to one I posted recently regarding the
> multiprocessing module and unicode.
>
> However, although this one manifests itself while using the
> multiprocess
Hi all
Is defaultdict thread safe?
Assume I have -
from collections import defaultdict
my_dict = defaultdict(list)
If two threads call "my_dict['abc'].append(...)" simultaneously, is it
guaranteed that my_dict['abc'] will end up containing two el
On Jan 25, 11:26 am, Raymond Hettinger wrote:
On Jan 25, 12:59 am, "Frank Millman" wrote:
> Hi all
> Is defaultdict thread safe?
Sometimes. It depends on whether an operation has callbacks to pure
Python.
> Assume I have -
> from collections import def
= ('a', 'b', 'c')
>>> t2 = 'x', + t[1:]
Traceback (most recent call last):
File "", line 1, in
TypeError: bad operand type for unary +: 'tuple'
>>>
It is not a problem - I will just stick to using the brackets. However, I
would be interested to find out the reason for the error.
Version is 2.6.2.
Thanks
Frank Millman
--
http://mail.python.org/mailman/listinfo/python-list
Diez B. Roggisch wrote:
> Frank Millman wrote:
>
>>
>>>>> t = ('a', 'b', 'c')
>>>>> t2 = 'x', + t[1:]
>> Traceback (most recent call last):
>> File "", line 1, in
>> TypeError: bad
you to supply arguments directly,
instead off putting them inside a tuple. I have tried with and without a
tuple - the result is the same.
Any assistance will be appreciated.
Thanks
Frank Millman
--
http://mail.python.org/mailman/listinfo/python-list
Tim Golden wrote:
> Frank Millman wrote:
>>
>>>>> cur.execute('select * from ctrl.dirusers where todate is ?', None)
>> Traceback (most recent call last):
>> File "", line 1, in pyodbc.ProgrammingError: ('42000',
>>
Tim Goldenwrote:
> Frank Millman wrote:
>>
>> I want the final WHERE clause to show 'WHERE todate IS NULL'.
>
> Of course, I understand that. What I mean is that if a piece
> of SQL say:
>
> WHERE table.column IS ?
>
> then the only possible (meani
ur main program -
- to start the timer
tmr = Timer()
tmr.start()
- to stop the timer
tmr.stop()
It is easy to extend this by passing the number_of_seconds_to_wait, or a
function name to be executed, as arguments to the Timer.
Frank Millman
--
http://mail.python.org/mailman/listinfo/python-list
the answer is yes, but I am no
expert. Perhaps someone else can confirm.
Thanks
Frank Millman
--
http://mail.python.org/mailman/listinfo/python-list
"Aaron Watters" wrote in message
news:69f74b6c-e996-4e5c-a9f2-b5173e33a...@d21g2000yqn.googlegroups.com...
> Let me vent my annoyance.
>
> In the last couple months on a few occasions
> I've tried various Python libraries (and I'm not going to
> name names) and run into some problem.
>
> Followi
"Aaron Watters" wrote in message
news:69f74b6c-e996-4e5c-a9f2-b5173e33a...@d21g2000yqn.googlegroups.com...
> Let me vent my annoyance.
>
> In the last couple months on a few occasions
> I've tried various Python libraries (and I'm not going to
> name names) and run into some problem.
>
> Followi
has happened to me before. The instructions
typically do not make it clear that you have to subscribe first, so I just
posted. After getting no response, I tried subscribing and then posting, and
it worked.
Instructions could be clearer, I agree.
Frank Millman
--
http://mail.python.org/mailman/listinfo/python-list
tasks and
terminated itself.
However, the queue is not empty - it still has the final None in it.
Is it advisable to finalise the cleanup like this? -
while not q.empty():
q.get()
q.task_done()
q.join()
Or is this completely redundant?
Thanks
Frank Millman
--
http
On Feb 6, 7:59 am, "Gabriel Genellina" wrote:
En Fri, 05 Feb 2010 09:45:30 -0300, Frank Millman
escribió:
[...]
> However, the queue is not empty - it still has the final None in it.
Yes - but who cares? :)
That was my point. I didn't think I needed to care, but I wa
On Feb 8, 4:51 pm, Steven wrote:
Queue objects have support for this signaling baked in with
q.task_done and q.join.
After the server process has put all tasks into the queue, it can join
the queue itself, not the worker threads.
q.join()
This will block until all tasks have been gotten AND
get=httpd.serve_forever).start()
Now it does respond to Ctrl-C.
HTH
Frank Millman
--
http://mail.python.org/mailman/listinfo/python-list
. return list.__new__(cls, values)
...
names = ['A', 'B', 'C']
values = ['a', 'b', 'c']
lst = MyList(names, values)
Traceback (most recent call last):
File "", line 1, in
TypeError: list() takes at most 1 argument (2 given)
I can find a workaround, but I would be interested to know the reason why it
does not work.
Version is 2.6.2.
Thanks
Frank Millman
--
http://mail.python.org/mailman/listinfo/python-list
"lbolla" wrote in message
news:f8011c0b-0b1b-4a4f-94ff-304c16ef9...@q16g2000yqq.googlegroups.com...
On Mar 31, 7:49 am, "Frank Millman" wrote:
Hi all
When subclassing immutable types, you need to override __new__;
otherwise you need to override __init__.
Perfe
On Mar 31, 8:49 am, "Frank Millman" wrote:
Hi all
Thanks to all for the helpful replies.
Rob, you are correct, I had not realised I was adding attributes to the
class instead of the instance. Your alternative does work correctly. Thanks.
Carl, I understand your concern about
---
I only target windows and linux. I don't know if it works for all platforms.
I wrote this a long time ago. I think it would now be preferable to use
subprocess() instead of os.popen().
Note the commented-out line in the linux block. This is an alternative
method I cri
can process it,
call start_response(), and return the response body, but I cannot figure out
how to get back to process the queued request.
Any advice will be much appreciated.
Frank Millman
--
http://mail.python.org/mailman/listinfo/python-list
Frank Millman wrote:
Hi all
I have a question about wsgi.
As far as I can tell from the spec and from the reference implementation,
wsgi requires that each request from the client is responded to by one or
more headers, followed by the response body. It is then ready to handle
the next
The one that was accepted consists of three bytes - 226, 128, 153 (as
reported by python 2.6) or 226, 8364, 8482 (as reported by python3.2).
The one that crashed consists of a single byte - 146 (python 2.6) or 8217
(python 3.2).
The issue is not that 2to3 should handle this correctly, but th
lt = eval('my_inst.{0}'.format(my_string))
This will only work if the string contains a valid method name with valid
arguments.
Can anyone see anything wrong with this?
Thanks
Frank Millman
--
http://mail.python.org/mailman/listinfo/python-list
here other techniques to get around the
problem.
Any suggestions will be appreciated.
Thanks
Frank Millman
--
http://mail.python.org/mailman/listinfo/python-list
"Frank Millman" wrote in message
news:i3ov9e$du...@dough.gmane.org...
Hi all
I know the problems related to circular imports, and I know some of the
techniques to get around them. However, I find that I bump my head into
them from time to time, which means, I guess, that I have
erval, plus any other parameters
required, as arguments.
HTH
Frank Millman
--
http://mail.python.org/mailman/listinfo/python-list
On Aug 14, 12:52 am, David wrote:
>
> Yes, I guess it would be more simple. Here is really what I am trying
> to do. I simplified the functions, but the purpose is to write some
> text in a local file every x seconds (here, I'm just writing the
> timestamp, i.e. a string representing the date & ti
d_0
MyClass.method_dict[1] = MyClass.method_1
As you can see, I had to add 'self' to the method arguments when calling the
method.
Any comments?
Thanks
Frank Millman
--
http://mail.python.org/mailman/listinfo/python-list
On Aug 26, 10:54 am, Chris Rebert wrote:
> On Wed, Aug 26, 2009 at 1:22 AM, Frank Millman wrote:
>
> A
>
> class MyClass(object):
> def on_message_received(self, msg):
> self.method_dict[msg](self)
>
> def method_0(self):
> print 'in
On Aug 26, 10:54 am, Chris Rebert wrote:
> On Wed, Aug 26, 2009 at 1:22 AM, Frank Millman wrote:
>
> A
>
> class MyClass(object):
> def on_message_received(self, msg):
> self.method_dict[msg](self)
>
> def method_0(self):
> print 'in
On Aug 26, 10:54 am, Chris Rebert wrote:
> On Wed, Aug 26, 2009 at 1:22 AM, Frank Millman wrote:
>
> A
>
> class MyClass(object):
> def on_message_received(self, msg):
> self.method_dict[msg](self)
>
> def method_0(self):
> print 'in
"MRAB" wrote in message
news:mailman.444.1251290454.2854.python-l...@python.org...
> An alternative is:
>
> >>> class MyClass(object):
> ... def on_message_received(self, msg):
> ... try:
> ... getattr(self, "method_%d" % msg)()
> ... except AttributeError:
> ...
Dave Angel wrote:
> Any time I see multiple lists like that which have to stay in
> synch, I think code-smell.
>
I don't think it is that bad, but I agree there is always room for
improvement.
> Why not let the EVT's be passed as strings, and avoid the whole mapping
> to integers and mapping
to stick to a news reader
like Outlook Express?
Thanks
Frank Millman
P.S. I am sending this message via email to python-list@python.org - let's
see what happens.
--
http://mail.python.org/mailman/listinfo/python-list
Dave Angel wrote:
>
> Show me a sample client event handler, and maybe I can suggest how to
> encode it. For example in wxPython, events are encoded with
> an event
> object. You could have the event send the object's type-string as an
> event ID. No lookup at all. And in fact, one event
Dave Angel wrote:
>
> Frank Millman wrote:
> >
> > That is definitely *not* what I want to do.
> >
> > I want to make the server as generic as possible, so that
> it can handle any
> > type of client, hopefully even including a browser
> eventually. Th
Dave Angel wrote:
> OK, that makes good sense. And I withdraw any suggestion to use pickling,
> since that could be subject to hacking.
>
> It now appears that the messages are only incidentally GUI events. And
> that you would be well advised to make every possible event a separate
> messag
"Frank Millman" wrote:
Apologies for the triple-post.
I use google-groups for reading c.l.py, but I know that some people reject
messages from there due to the volume of spam, so on the odd occasion when I
want to send something I fire up Outlook Express and send it from there. It
Anthony Tolle wrote:
> To take things one step further, I would recommend using decorators to
> allow symbolic association of functions with the message identifiers,
> as follows:
>
[...]
That's neat. Thanks.
Frank
--
http://mail.python.org/mailman/listinfo/python-list
tart()
At the end of the program, terminate the loop like this -
data_getter.stop()
HTH
Frank Millman
--
http://mail.python.org/mailman/listinfo/python-list
harryos wrote
Here is a technique that allows the loop to run in the background, in its
own thread, leaving the main program to do other processing -
import threading
class DataGetter(threading.Thread):
thanks Frank
A pleasure.
I left out a line that will usually be desirable.
At the e
values to unpack (expected 2, got 1)
It does not show the line where the ValueError occurs, and I have not
managed to narrow down exactly when this happens.
Does anyone know what I must change to get the full traceback?
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
John Ladasky wrote in message
news:72209011-db09-4ba2-9c5b-f576a30e2...@googlegroups.com...
> Does anyone know what I must change to get the full traceback?
Three years ago, I had a similar issue with incomplete tracebacks while
using multiprocessing.Pool. The discussion is here:
https://g
"Frank Millman" wrote in message news:o93vs2$smi$1...@blaine.gmane.org...
I use asyncio in my project, so most of my functions start with 'async'
and
most of my calls are preceded by 'await'.
If an exception is raised, I usually get the full traceback, but so
"INADA Naoki" wrote in message
news:caefz+tyudwjesyttqzg2_romphmjrxqaga2ulgfqv5qbpii...@mail.gmail.com...
I can't reproduce it on Linux.
Maybe, it's windows specific bug?
import asyncio
from itertools import count
async def aenumerate(aiterable):
counter = count()
async for x in aite
"Frank Millman" wrote in message news:o994og$84k$1...@blaine.gmane.org...
If I place '1/0' in main(), this is the traceback -
Traceback (most recent call last):
File "test_db1a.py", line 25, in
loop.run_until_complete(main())
File "/usr/local/l
"INADA Naoki" wrote in message
news:caefz+tz8hvwmh5cf17mv3accdqthj1axddga8umnznuuwes...@mail.gmail.com...
> For completeness, if I place '1/0' in aenum(), I get exactly the same
> traceback as the first one above.
>
I can't reproduce it too.
Did you 3.6.0 this time? Or did you used 3.6b4 aga
r, it does
not.
If I type 'alias' at the console, it lists current aliases. 'root' shows
exactly what Jon quoted above. 'frank' shows no alias for 'rm'.
I had a quick look to see what was setting it, but there is nothing in
/etc/profile or in /etc
"Frank Millman" wrote in message news:oa8uaf$k9e$1...@blaine.gmane.org...
On Fedora 22 (and for many previous versions) I have noticed that, if I
log
in as 'root', it does prompt, but if I log in as an ordinary user, it does
not.
If I type 'alias' at the con
ow only
works for INSERT statements.
For UPDATE, you usually have to say -
UPDATE {table} SET col_1 = val_1, col_2 = val_2 WHERE col_3 = val_3 ...
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
ys calls conn.commit() or conn.rollback() on exit, and I
have not had any more problems. I use exactly the same code for sqlite3 and
for Sql Server/pyodbc, and it has not caused any problems there either.
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
"Frank Millman" wrote in message news:ogr3ff$sg1$1...@blaine.gmane.org...
By default, psycopg2 uses 'autocommit', which means that even a SELECT is
preceded by a 'BEGIN' statement internally. I never changed the default, so
all of the following assumes tha
except StopIteration as e:
final_result = e.value
Is this the best way to achieve it, or is there a nicer alternative?
Thanks
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
"Jussi Piitulainen" wrote:
Frank Millman writes:
> It would be nice to write a generator in such a way that, in addition
> to 'yielding' each value, it performs some additional work and then
> 'returns' a final result at the end.
>
> From Python
def __init__(self):
a= 'aa'
b= 'ab'
In your __init__() function, 'a' and 'b' are not bound to anything, so they
are simply local variables and will be garbage-collected when the function
has completed.
Therefore any instance of ClassA() will get its values of 'a' and 'b' from
the class definition - an empty string.
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
for day, month, year in datesRange(-210, 0):
# do something
Does this help?
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
github.com/FrankMillman/AccInABox.
You are welcome to look at it, but it needs a lot of tidying up before
it will be ready for a wider audience.
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
'DbParams']). But I would still like
an answer to the original question, as I am sure similar situations will
occur without such a simple solution.
Thanks
Frank Millman
--
https://mail.python.org/mailman/listinfo/python-list
ry simple program to illustrate this.
Am I missing something? All comments appreciated.
Frank Millman
==
import gc
class delwatcher:
# This stores enough information to identify the object being watched.
# It does not store a reference
On 2024-01-15 3:51 PM, Frank Millman via Python-list wrote:
Hi all
I have read that one should not have to worry about garbage collection
in modern versions of Python - it 'just works'.
I don't want to rely on that. My app is a long-running server, with
multiple clients lo
On 2024-01-16 2:15 PM, Chris Angelico via Python-list wrote:
Where do you tend to "leave a reference dangling somewhere"? How is
this occurring? Is it a result of an incomplete transaction (like an
HTTP request that never finishes), or a regular part of the operation
of the server?
I have a c
On 2024-01-17 3:01 AM, Greg Ewing via Python-list wrote:
On 17/01/24 1:01 am, Frank Millman wrote:
I sometimes need to keep a reference from a transient object to a more
permanent structure in my app. To save myself the extra step of
removing all these references when the transient object is
PT_DYNAMIC Debian 6.1.76-1
(2024-02-01) x86_64 GNU/Linux
$ python3 -V
Python 3.11.2
$ pip3 freeze
asgiref==3.7.2
blinker==1.7.0
click==8.1.7
Flask==3.0.2
itsdangerous==2.1.2
Jinja2==3.1.3
MarkupSafe==2.1.5
Werkzeug==3.0.1
```
Thanks for any help!
Cheers,
Thomas
Hi Thomas
I am no exper
On 2024-03-22 12:09 PM, Frank Millman via Python-list wrote:
I am no expert. However, I do have something similar in my app, and it
works.
I do not use 'await future', I use 'asyncio.wait_for(future)'.
I tested it and it did not work.
I am not sure, but I think the
On 2024-03-22 1:23 PM, Frank Millman via Python-list wrote:
On 2024-03-22 12:09 PM, Frank Millman via Python-list wrote:
I am no expert. However, I do have something similar in my app, and it
works.
I do not use 'await future', I use 'asyncio.wait_for(future)'.
I test
On 2024-03-22 12:08 PM, Thomas Nyberg via Python-list wrote:
Hi,
Yeah so flask does support async (when installed with `pip3 install
flask[async]), but you are making a good point that flask in this case
is a distraction. Here's an example using just the standard library that
exhibits the sam
On 2024-03-23 3:25 PM, Frank Millman via Python-list wrote:
It is not pretty! call_soon_threadsafe() is a loop function, but the
loop is not accessible from a different thread. Therefore I include a
reference to the loop in the message passed to in_queue, which in turn
passes it to
701 - 777 of 777 matches
Mail list logo