Also think through which Windows account will run the service, and what
permissions it will need. A little up front work here will be
appreciated by the people who have to install your service.
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I have a two fold question:
-how to attach the debugger to running multi threaded program
-the objective is to find an infinite loop in one of threads which
makes the whole thingy going craze (100%CPU)
The program itself is not easy, in fact quite hude and sometimes it
takes
Bill Pursell wrote:
> Now, in another shell,
> % gdb
> (gdb) attach 54321
>
Thx for the reply. But I wish to debug the python program, not python
interpreter itself.
--
http://mail.python.org/mailman/listinfo/python-list
thx, alf
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> alf wrote:
>
>>I have one thread app using SocketServer and use server_forever() as a
>>main loop. All works fine, but now I need certain timer checking let's
>>say every 1 second something and stopping the main loop. So questions are:
>&
Hi,
I have a following task: let's say I do have an iterator returning the
some objects:
>>i=
>>i.next()
1
>>i.next()
'abgfdgdfg'
>>i.next()
For some reason I need to wrap thos objects with a list. I thought I
could have a smart lamda or simple function class yielding following result:
Simon Forman wrote:
>class LW(object): # ListWrapper
>>... def __init__(self, i):
>>... self.theiter = i
>>... def next(self):
>>... return [self.theiter.next()]
I hoped one lamda would take care of it but looks like it is a simplest
choice.
> |>> I = ([n] for n in
Simon Forman wrote:
>>
>>>|>> I = ([n] for n in i)
>>
>>This is nice but I am iterating thru hude objects (like MBs) so you know ...
>>
>
> No, I don't know... :-)
potentially my source lists are huge - so wanted to avoid unnecessary
memory allocation
> My friend, I think you've misunderstood
Paul Rubin wrote:
> alf <[EMAIL PROTECTED]> writes:
>
>>>|>> I = ([n] for n in i)
>>
>>This is nice but I am iterating thru hude objects (like MBs) so you know ...
>
>
> I don't understand the objection-- the above is entirely correct and
>
to get pure wavs...
Hope I find someone here helping me with that
--
alf
--
http://mail.python.org/mailman/listinfo/python-list
know where
to find the answer.
--
alf
--
http://mail.python.org/mailman/listinfo/python-list
choose while the
priority is the stable app.
--
alf
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
according to rfc2046, line breaks in MIME are CRLF. However python just
uses LF like in the following example:
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
msg = MIMEMultipart()
msg['Subject'] = 'Our family reunion'
msg['From'] = '[EMAIL PROTECTED]'
msg
Gabriel Genellina wrote:
> At Thursday 5/10/2006 18:52, alf wrote:
>
>> according to rfc2046, line breaks in MIME are CRLF. However python just
>> uses LF like in the following example:
>
>
> The comments inside generator.py say CRLF everywhere, but the code
> si
Hi,
I use subprocess to execute another program but need to suppress its stdout.
I can achieve it by using Popen(...,stdout=subprocess.PIPE,...) but
wonder where the all stdout actually goes. Is it buffered (to eventually
fill up)or just discarded?
Or there is a better solution ...
Thx, alf
following lines
and the indentation gets messed up.
I can use sys.stdout.write('enter command:') instead but kind of do not
like sys.stdout.write mixed up with print's statements used to display
other informations.
Is there a pythonic solution for the problem?
Thx, alf
--
http:
Hi,
I did my homework and researched the net - can not find the python
support for TIPC.
Does anybody know if there are plans to implement it?
--
alf
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh wrote:
> "alf" <[EMAIL PROTECTED]> wrote:
>
>
>>I can achieve it by using Popen(...,stdout=subprocess.PIPE,...) but
>>wonder where the all stdout actually goes. Is it buffered (to eventually
>>fill up)
>
>
> it ends up in a pip
Hi,
I downloaded the latest found version and untared it - but can not find
any information how to install it. I guess it is boost based ...
Has any body played with it recently?
--
alf
--
http://mail.python.org/mailman/listinfo/python-list
Steve Holden wrote:
> Or use raw_input(), which was designed for such situations:
>
thx, did not know about that ...
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I try to summarize what is available in python for graphical images
processing. So far I found:
-PythonMagic
-PIL
-SDL_image
Are all supported, which is most mature, in which I could perform for
instance 'Ken Burns effect' or light filling operations. Is there
anything else?
Hi,
wonder if in the python I could treat modules imorts like classes
instances. It means I could import it twice or more times under
different names.
--
alfz1
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I need to find all modules/lib from the site-packages along with the
versions. Is there a way to determine physical path to the module?
And is there is a way to identify all potential "importable" modules?
--
alf
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh wrote:
> alf wrote:
>
>> Are all supported, which is most mature, in which I could perform for
>> instance 'Ken Burns effect'
>
>
> that's a display effect, not an image effect. you need a display (or
> animation) library for that.
[EMAIL PROTECTED] wrote:
> Hi,
>
> When I was talking with my friend, I wanted to share the music I'm
> listening with
> my friend. I mean, I wanted my friend to hear my music and my own sound .
>
> I order to achieve this, I think I need to append the output of my sound
> card to
> the input o
Hi,
Would it be .append()? Does it reallocate te list with each apend?
l=[]
for i in xrange(n):
l.append(i)
Thx, A.
--
http://mail.python.org/mailman/listinfo/python-list
is there any way to tell the class the base class during runtime?
a.
--
http://mail.python.org/mailman/listinfo/python-list
bruno at modulix wrote:
>
> *But* you'd probably better tell us about the problem you're trying to
> solve. Since in Python, inheritance is mostly about implementation (ie:
> not needed for subtyping), your problem would probably be best solved
> with composition/delegation, for which Python offe
Michele Simionato wrote:
> alf wrote:
> Python is ways cooler than C++.
I switched to Python from C++ over year ago and do not see a way back.
C++ just sucks at each corner.
> This is a sensible use case where you may
> want to change the base class at runtime:
Thx for the
SMTPChannel. What bothers me that some
code duplication from SMTPServer.__init__ and
SMTPChannel.smtp_MAIL/RCPT will have to take place.
Is there any way to avoid it. Probably not :-( ...
--
alf
--
http://mail.python.org/mailman/listinfo/python-list
any way to force the actual python site-lib for M$ installers
thx in advance,
--
alf
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh wrote:
> "alf" <[EMAIL PROTECTED]> wrote:
>
>
>>It turned out it is quite simple - I just install the python from
>>python.org and all the libs needed. Then I take python2n.dll from
>>c:\win*\system32 and move directly to PYTHONDIR. T
Hi,
is there any way in Python to have iostream like __str__ operator?
--
alf
--
http://mail.python.org/mailman/listinfo/python-list
n's installer" :-).
ok, let me clarify, by M$ I meant Micro$oft.
--
alf
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh wrote:
>
> http://www.catb.org/~esr/faqs/smart-questions.html#writewell
>
>
and means?
--
http://mail.python.org/mailman/listinfo/python-list
Robert Kern wrote:
> alf wrote:
>
>> Fredrik Lundh wrote:
>>
>>> http://www.catb.org/~esr/faqs/smart-questions.html#writewell
>>>
>>>
>>
>>
>> and means?
>
>
> It's his signature.
>
The sig is delimited by '-- \n'
--
alf
--
http://mail.python.org/mailman/listinfo/python-list
Georg Brandl wrote:
>>>
>>> It's his signature.
>>>
>>
>> The sig is delimited by '-- \n'
>
>
> Yes, and Earth is a disk.
>
how deep
--
alf
--
http://mail.python.org/mailman/listinfo/python-list
out!
>
> Sybren
thx for sharing the experience. Do you know how to save a OO doc into M$
Excel format - I have a Python based server running on Linux box and
need to produce Excel files.
--
alf
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
can someone explane this:
>>> from time import *
>>> timezone
18000
>>> t=time()
>>> mktime(gmtime(t))-t
17999.680048942566
why there is a difference?
--
alf
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I have a reference to certain objects. What is the most pythonic way to
test for valid reference:
if obj:
if None!=obs:
if obj is not None:
--
alfz1
--
http://mail.python.org/mailman/listinfo/python-list
Paul Rubin wrote:
> alf <[EMAIL PROTECTED]> writes:
>
>> >>> t=time()
>> >>> mktime(gmtime(t))-t
>>17999.680048942566
>>why there is a difference?
>
>
> time() is a floating point number with fractional seconds.
> gmtime()
Hi,
Let's run following:
>>> re.compile('(\[.*?\])').split('[aa]bb[11]22')
['', '[aa]', 'bb', '[11]', '22']
Why does it return '' as a first element of the list?
Any insight?
--
alf
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh wrote:
> alf wrote:
>
>> Let's run following:
>>
>> >>> re.compile('(\[.*?\])').split('[aa]bb[11]22')
>> ['', '[aa]', 'bb', '[11]', '22']
>>
>> Why does
Hi,
I can not find out where the extra space comes from. Run following:
import os,sys
while 1:
print 'Question [Y/[N]]?',
if sys.stdin.readline().strip() in ('Y','y'):
#do something
pass
$ python q.py
Question [Y/[N]]?y
Question [Y/[N]]?y
Question [Y/[N]]?y
Ques
Hi,
is there a more elegant way to get o.__class__.__name__. For instance I
would imagine name(o).
--
alf
--
http://mail.python.org/mailman/listinfo/python-list
Mark Tarver wrote:
> How do you compare Python to Lisp?
A little bit OT but I can not resist it. What always impressed me with
Lisp is that LOGO (any one remembers) is Lisp based yet designed to
teach kids programming. I do not know Lisp but used to program a bit in
LOGO - everything was so na
alf wrote:
> Hi,
>
> I have a reference to certain objects. What is the most pythonic way to
> test for valid reference:
>
> if obj:
>
> if None!=obs:
>
> if obj is not None:
>
thx for all answers - now "if obj is not None:" in an ob
Simon Percivall wrote:
>
> You already got the answer, but as for the rest: It's really easier for
> you if you use raw_input() for your question/input pair instead.
>
thx, this is what I was looking for, alf
--
http://mail.python.org/mailman/listinfo/python-list
alf wrote:
> Hi,
> is there a more elegant way to get o.__class__.__name__. For instance I
> would imagine name(o).
>
decided to stick to o.__class__.__name__ for readibility.
--
alfz1
--
http://mail.python.org/mailman/listinfo/python-list
able to figure it out - with a little help ;-)
Currently I am stuck in not being able to identify the Tcl equivalent
of Python's "putrequest", as in:
h = httplib.HTTP("wctp.skytel.com",80)
h.putrequest("POST","/wctp")
Thanks
alf
--
http://mail.python.org/mailman/listinfo/python-list
Cameron Laird wrote:
> In article <[EMAIL PROTECTED]>,
> Fuzzyman <[EMAIL PROTECTED]> wrote:
> >
> >alf wrote:
> >> Hi
> >>
> >> I would like to convert the wctpXml-1.3.py program to Tcl (line by
> >> line).
> >> See ht
Hi,
I wonder how to launch from python default Windows browser? In fact I
have the same question for Linux.
thx in advancve,
--
alf
--
http://mail.python.org/mailman/listinfo/python-list
Laurent Pointal wrote:
>
> Via webbrowser module
>
> http://docs.python.org/lib/module-webbrowser.html
>
thx a lot. Just again Python positively surprises me.
> (note: its in top five in google search for Python + launch + browser...)
so now it will be in top four :-).
--
http://mail.pytho
Hi,
I want to develop a following lib:
lib space user space
A -> B -> | -> user_class
however A and B are abstrac enough to have following:
user_super_base_class -> | -> A -> B -> | -> user_class
user space lib space user spaca
Any idea how to do that?
--
al
question without words:
>>> r"\"
File "", line 1
r"\"
^
SyntaxError: EOL while scanning single-quoted string
>>> r"\ "
'\\ '
--
http://mail.python.org/mailman/listinfo/python-list
n the class name can point to
the module as well as the line number where the given class is defined.
Is it doable in Python?
--
alf
--
http://mail.python.org/mailman/listinfo/python-list
p0 0 0.0.0.0:12345 0.0.0.0:*
3248/python
[1] + Terminatedpython ss.py
Why it is happening? I know that os.system uses fork, but still this is
something unexpected.
Thx, Alf
--
http://mail.python.org/mailman/listinfo/python-list
he child process once parent gets killed. what it the
parent got multiple subprocesses.
Plus it is kind of unintuitive os.system does not protect from such
behavoir which is for me more an equivalent of like issuing a ne
wcommand/ starting a process from the shell.
Thx,
--
alf
--
http://ma
two ways of achieving the same effect
l+=[n]
or
l.append(n)
so which is more pythonic/faster?
--
alfz1
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I have a small app which consist of a few .py files. Is there any way to
distribute it in jar like fashion as a single file I can just run python
on. I obviously look for platform independent solution.
Thx in advance, A.
--
http://mail.python.org/mailman/listinfo/python-list
alain wrote:
> Hi,
>
> I have a Python app and i would like to add some SNMP agent
> functionality to it.
> I know it's possible to write a sub-agent with netsnmp but it is in C
> and quite complicated.
> I know of YAPSNMP (a wrapper around NETSNMP) but it doesn't seem to
> support agent writing.
Hi,
I want to add some library but it can not be comipled? Here is an output:
D:\>cl
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.42
for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
usage: cl [ option... ] filename... [ /link linkoption... ]
D:\> pyth
Hi,
there is problem when I import (python 2.4) wx and SOAPpy at the same
time. I narrowed the problem to following (on Linux):
>>import wx
>>import pyexpat
Traceback (most recent call last):
File "", line 1, in ?
ImportError:
/apps/public/python_2.4.4/lib/python2.4/lib-dynload/pyexpat.so:
le bit, get around registry
paths and was able to produce .pyo file. Then I hit some runtime lib
issues. In meantime I found precompiled probstat lib so gave up on
making msvccompiler.py compatible with VS 2008.
Bottomline - it would be nice to have such support.
--
alf
--
http://mail.python.org/mailm
Hi,
I have another problem with wxpython - that is the best place to report
bug - evident memory leak on Linux and win32.
--
alf
--
http://mail.python.org/mailman/listinfo/python-list
Martin v. Löwis wrote:
>>well, instructions were clear enough for me. What is hard to get why it
>>could not use free M$ compiler which is presumably produces compatible
>>objects and libraries.
>
>
> This presumption is incorrect. The compiler does *not* create compatible
> objects and libraries
Martin v. Löwis wrote:
> You either would have to create a import library for mscvr71.dll
> by hand, or you have to copy one from VS 2003 (breaking its license).
I wonder if copying the probstat.pyd from internet where I it finnaly
found is not breaking the license:-). it was my final solution
Amaury Forgeot d'Arc wrote:
> alf a écrit :
>
>> Hi,
>>
>> there is problem when I import (python 2.4) wx and SOAPpy at the same
>> time. I narrowed the problem to following (on Linux):
>>
>> >>import wx
>> >>import pyexpat
Hi,
there is following issue: "import cx_Oracle" on windows pops up a nice
'DLL missing' window in case there indeed is no CLI.DLL (or something
like that). Then the exception is raised.
Catching the exception is obviously not a problem, but the popup
practically blocks the application and
Hi,
executing main.py reulsts in following:
[EMAIL PROTECTED] andy]$ python main.py
Traceback (most recent call last):
File "main.py", line 4, in ?
amodule.f()
File "/raid/home/andy/amodule.py", line 3, in f
print a
NameError: global name 'a' is not defined
How can I have global
Gabriel Genellina wrote:
> Change a=1 to amodule.a=1
I have multiple command line programs creating 'a' and amodule using it.
Plus some import sequence dependency. So it would not work. Currently
the solution in amodule is:
import __main__
print __main__.a
> If you find yourself doing tricks
Sulsa wrote:
> sorry, wrong group.
the group is correct but language wrong, did you find out why the
exception pops up
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
is there a more elegant way to do that:
''.join([chr(ord(i)) for i in u'11\xa022' ])
--
thx, alf
--
http://mail.python.org/mailman/listinfo/python-list
Jean-Paul Calderone wrote:
> u'11\xa022'.encode('charmap')
thx a lot. one more question, once a unicode object is created e.g.
u=unicode('hello', 'iso-8859-1')
is there any way to find:
1-original encoding of u
2-list of supported encodings?
A.
--
http://mail.python.org/mailma
Hi,
I have a few places in the code where I use:
try:
code_block
except A:
exception_handling
the code block is different each time while exception_handling the same.
What would be the best technique to abstract that out?
--
A.
--
http://mail
david wrote:
> On Tue, 13 Nov 2007 06:17:26 -0300, Gabriel Genellina wrote:
>
>> A function?
>>
>> try:
>> code_block
>> except A:
>> handle_exception()
>
> maybe
>
def handle(f, *args, **kw):
> ... try:
> ... return f(*args, **kw)
> ...
Hi,
I wonder why it is an invalid syntax:
>>> if 1: if 1: if 1: print 1
File "", line 1
if 1: if 1: if 1: print 1
or
>>> if 1: for i in range(10): print i
File "", line 1
if 1: for i in range(10): print i
I would expect one could nest
Jeff wrote:
> That is the behavior of the development server. When you are writing
> your application, you don't want to have to manually restart the
> server every time you change a file. On apache it obviously doesn't
> do that.
thx for clarification, but still I am curious how it is done unde
hi,
I started playing with django and accidentally discovered that it
restarts the server once a source file is touched.
does it use some python's feature or just scans for changs on its one?
sources?
any idea?
A.
--
http://mail.python.org/mailman/listinfo/python-list
Jeff wrote:
> On Jan 17, 2:51 pm, "Guilherme Polo" <[EMAIL PROTECTED]> wrote:
>> 2008/1/17, alf <[EMAIL PROTECTED]>:> Jeff wrote:
>>>> That is the behavior of the development server. When you are writing
>>>> your application, you don
Hi,
is there any way to tweak __import__ so it imports module with another
arbitrary selected module included?
For instance I have my mylibs.py module. Then when I import a
oneofhundredssmallmodules.py module from other place the mylibs.py is
automatically imported without a explicit import. T
Hi,
what is the best way to reload the module imported using 'from ...
import ...'
Is following a way to do so?
>>> from email.charset import Charset
>>> reload(email.charset)
Traceback (most recent call last):
File "", line 1, in
NameError: name 'email' is not defined
>>>
>>>
>>> import
Steven D'Aprano wrote:
On Sun, 09 Aug 2009 20:43:41 -0700, AlF wrote:
Hi,
what is the best way to reload the module imported using 'from ...
import ...'
Have you tried "from ... import ..." again?
I have not because of an assumption that "import" imp
.6.5 Doc strings.44
2.6.6 Interlude IV: attribute names as strings, listing str attributes. 45
2.6.7 References. 46
EOT 49
The section on "References", 2.6.7, is about references in Python, it's not a
list of references. :-)
Cheers,
- Alf
--
http://mail.python.org/mailman/listinfo/python-list
thers me...
I think if one could somehow declare names as const (final, readonly, whatever)
then that would cover the above plus much more.
Cheers,
- Alf
--
http://mail.python.org/mailman/listinfo/python-list
ystem, so it's evaluated as
"(-3)**2". If x contained text and was evaluated as such, pure text replacement,
then you should be able to write 2 x and have that evaluated as "2 -x"...
Cheers & hth.,
- Alf
--
http://mail.python.org/mailman/listinfo/python-list
* Jean-Michel Pichavant:
Steven D'Aprano wrote:
On Mon, 30 Nov 2009 02:11:12 +0100, Alf P. Steinbach wrote:
I think if one could somehow declare names as const (final, readonly,
whatever) then that would cover the above plus much more.
Having real constants is one feature that I
* Alf P. Steinbach:
I added a section on "basic data" to ch 2 of my writings, an
introduction to programming (with Python as main language).
The intended reader is someone who is intelligent and wants to learn
programming but knows little or nothing about it.
As before it would be
o "procedures" like:
def square(length):
forward(length)
right(90)
forward(length)
right(90)
forward(length)
right(90)
forward(length)
right(90)
Plotting a graph. Some examples of that in ch 2 of aforementioned URL.
Cheers & hth.,
- Alf
--
http://mail.
area ) ) as toggle_button:
toggle_button.config( text = " Toggle it " )
toggle_button.pack( anchor = "w" )
interaction_area.pack( side = "left" )
display_area.place( relx = 0.5, rely = 0.5, anchor = "center" ) # Centered
window.mainloop()
Is this guaranteed to work in Python 3.x?
>>> def foo(): pass
...
>>> foo.blah = 222
>>> foo.blah
222
>>> _
Cheers,
- Alf
--
http://mail.python.org/mailman/listinfo/python-list
* Marco Mariani:
Alf P. Steinbach wrote:
Is this guaranteed to work in Python 3.x?
>>> def foo(): pass
>>> foo.blah = 222
>>> foo.blah
222
>>> _
I don't see why it shouldn't work.
For example,
(42).blah = 666
The question is w
* Raymond Hettinger:
On Dec 4, 2:03 am, "Alf P. Steinbach" wrote:
Is this guaranteed to work in Python 3.x?
>>> def foo(): pass
...
>>> foo.blah = 222
>>> foo.blah
222
Yes, function attributes are guaranteed to be writable:
http://www.python.o
ctive console i/o one solution could be some Python module for
interactive console i/o, on Windows internally using the Windows console
function API, which is fully Unicode (based on UCS-2, i.e. the BMP).
Cheers,
- Alf
Another workaround is to use a real file:
import sys
f = open('afile.h
* Steven D'Aprano:
On Sat, 05 Dec 2009 11:26:34 +0100, Alf P. Steinbach wrote:
Regarding my terminology, "routine" instead "function" that everybody
except you remarked on, it is of course intentional. [...]
I think you failed to realise that your use of the term
* Dennis Lee Bieber:
On Sat, 05 Dec 2009 11:26:34 +0100, "Alf P. Steinbach"
declaimed the following in gmane.comp.python.general:
The devolution of terminology has been so severe that now even the Wikipedia
article on this subject confounds the general concept of "routine"
* MRAB:
Alf P. Steinbach wrote:
> * Dennis Lee Bieber:
>> On Sat, 05 Dec 2009 11:26:34 +0100, "Alf P. Steinbach"
>> declaimed the following in
>> gmane.comp.python.general:
>>
>>> The devolution of terminology has been so severe that now e
ore
subsections of 2.7, but I'm not quite sure about how to approach that or exactly
how much to cover, since the intent of ch 2 is to introduce mostly general
concepts and enable the reader to try out (more or less) interesting things.
Cheers,
- Alf
PS: comments welcome!
om/ProgrammingBookP3>
which is in Google Docs; a table of contents available as text file (it's not
complete wrt. to latest stuff I added) and also in the PDF files themselves.
Comments very welcome! :-)
Cheers,
- Alf
PS: The last three or four paragraphs in ch 2 were sort of negativ
* rm:
On Dec 9, 9:46 pm, "Alf P. Steinbach" wrote:
* rm:
Here is a new tutorial that may be a good starting point for learning
Python.
http://www.themaemo.com/python-for-newbies/
Looks nice.
I have two comments: (1) what is "the N900"?, and (2) the naming conventio
1 - 100 of 648 matches
Mail list logo