Friday, February 5, 2010

comp.lang.python - 25 new messages in 11 topics - digest

comp.lang.python
http://groups.google.com/group/comp.lang.python?hl=en

comp.lang.python@googlegroups.com

Today's topics:

* pyclutter anyone? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/88aaddf9983d514c?hl=en
* C:\Python25\Lib\IDLELIB\idle.pyw won't start - 4 messages, 3 authors
http://groups.google.com/group/comp.lang.python/t/0dbc675fff5ecf07?hl=en
* xmlrpc slow in windows 7 if hostnames are used - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/e4157a12dd9ece8c?hl=en
* come and join www.pakdub.com where u can find friends, classifieds, games,
music albums, events, blogs, chatrooms, video songs and lot more.... for free -
1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/26203e65d2a61cac?hl=en
* Python and Ruby - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/dfe4f6c60032755e?hl=en
* Your beloved python features - 6 messages, 6 authors
http://groups.google.com/group/comp.lang.python/t/599b3c9772421ece?hl=en
* Wrap a function - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/fce27f8c4a22d12b?hl=en
* Building a multiline string - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/cb131609c7b065a9?hl=en
* Employee motivation in the software industry - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/ade12a9b8f5f2122?hl=en
* Repost: Read a running process output - 5 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/195cc1de992e13b3?hl=en
* Simple question about Queue.Queue and threads - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/032256dd608c9c02?hl=en

==============================================================================
TOPIC: pyclutter anyone?
http://groups.google.com/group/comp.lang.python/t/88aaddf9983d514c?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Feb 5 2010 12:01 am
From: donn


Hi, this is a little bit of a cross-post. I posted to the clutter list,
but there's little activity there.

I am trying to make sense of pyClutter 1.0. Could anyone point me to an
example (or post one) that shows clipping from a path applied to child
objects?

For example: A star shape that contains a bunch of moving rectangles
which will travel/size/rotate with the star, but are clipped to the
shape of the star.

I suspect this will involve a custom clutter.Group class of some kind,
with cogl paths and an on_paint() method, but I can find no headway on
the web so far.

Hope someone can help!
\d

--
Fonty Python and Things! -- http://otherwise.relics.co.za/wiki/Software


==============================================================================
TOPIC: C:\Python25\Lib\IDLELIB\idle.pyw won't start
http://groups.google.com/group/comp.lang.python/t/0dbc675fff5ecf07?hl=en
==============================================================================

== 1 of 4 ==
Date: Fri, Feb 5 2010 12:36 am
From: Anthra Norell


Hi,

I upgraded from 2.4 to 2.5 and am unable to start an 2.5 idle window.

This is the command I have been using:
C:\Python24\pythonw.exe C:\Python24\Lib\IDLELIB\idle.pyw -n -c
execfile('C:\\Python24\\i')

And this is the command that doesn't start anything:
C:\Python25\pythonw.exe C:\Python25\Lib\IDLELIB\idle.pyw -n -c
execfile('C:\\Python25\\i')

The command is exactly the same with the digit 5 in the place of 4. All
paths and names are correct. C:\\Python25\\i sets up sys.path but seems
irrelevant, as taking the execfile () part out doesn't change anything.
The OS is Windows ME. The download of 2.5 finished with a warning saying
that 2.5 was the highest version for Windows 9* Any tips?

Thanks

Frederic

== 2 of 4 ==
Date: Fri, Feb 5 2010 1:01 am
From: "Alf P. Steinbach"


* Anthra Norell:
> Hi,
>
> I upgraded from 2.4 to 2.5 and am unable to start an 2.5 idle window.
>
> This is the command I have been using:
> C:\Python24\pythonw.exe C:\Python24\Lib\IDLELIB\idle.pyw -n -c
> execfile('C:\\Python24\\i')
>
> And this is the command that doesn't start anything:
> C:\Python25\pythonw.exe C:\Python25\Lib\IDLELIB\idle.pyw -n -c
> execfile('C:\\Python25\\i')
>
> The command is exactly the same with the digit 5 in the place of 4. All
> paths and names are correct. C:\\Python25\\i sets up sys.path but seems
> irrelevant, as taking the execfile () part out doesn't change anything.
> The OS is Windows ME. The download of 2.5 finished with a warning saying
> that 2.5 was the highest version for Windows 9* Any tips?

Don't know, but the '-n' option, is that passed to IDLE?

Perhaps try removing that.


Cheers & hth.,

- Alf


== 3 of 4 ==
Date: Fri, Feb 5 2010 3:38 am
From: Duncan Booth


Anthra Norell <anthra.norell@bluewin.ch> wrote:

> Hi,
>
> I upgraded from 2.4 to 2.5 and am unable to start an 2.5 idle
> window.
>
> This is the command I have been using:
> C:\Python24\pythonw.exe C:\Python24\Lib\IDLELIB\idle.pyw -n -c
> execfile('C:\\Python24\\i')
>
> And this is the command that doesn't start anything:
> C:\Python25\pythonw.exe C:\Python25\Lib\IDLELIB\idle.pyw -n -c
> execfile('C:\\Python25\\i')
>
> The command is exactly the same with the digit 5 in the place of 4.
> All paths and names are correct. C:\\Python25\\i sets up sys.path but
> seems irrelevant, as taking the execfile () part out doesn't change
> anything. The OS is Windows ME. The download of 2.5 finished with a
> warning saying that 2.5 was the highest version for Windows 9* Any
> tips?
>
> Thanks
>
Does 'unable to start a 2.5 idle window' mean you get some sort of error
or simply that nothing happens?

What happens if you simply run C:\Python25\Lib\IDLELIB\idle.bat
Does that work or not?

What about running this from a command prompt:

C:\Python25\python.exe C:\Python25\Lib\IDLELIB\idle.py

Does that run idle or do you get any error messages?
What about this?

C:\Python25\python.exe C:\Python25\Lib\IDLELIB\idle.pyw

Using pythonw.exe will start the program with all error output dumped in
the bit bucket. Running from a command prompt with python.exe will at
least let you see if there are any errors.

--
Duncan Booth http://kupuguy.blogspot.com


== 4 of 4 ==
Date: Fri, Feb 5 2010 5:23 am
From: Anthra Norell


Thank you both (Alf and Duncan) for your comments. I answer Duncan's
questions interleaved:

Duncan Booth wrote:
> Anthra Norell <anthra.norell@bluewin.ch> wrote:
>
>
>> Hi,
>>
>> I upgraded from 2.4 to 2.5 and am unable to start an 2.5 idle
>> window.
>>
>> This is the command I have been using:
>> C:\Python24\pythonw.exe C:\Python24\Lib\IDLELIB\idle.pyw -n -c
>> execfile('C:\\Python24\\i')
>>
>> And this is the command that doesn't start anything:
>> C:\Python25\pythonw.exe C:\Python25\Lib\IDLELIB\idle.pyw -n -c
>> execfile('C:\\Python25\\i')
>>
>> The command is exactly the same with the digit 5 in the place of 4.
>> All paths and names are correct. C:\\Python25\\i sets up sys.path but
>> seems irrelevant, as taking the execfile () part out doesn't change
>> anything. The OS is Windows ME. The download of 2.5 finished with a
>> warning saying that 2.5 was the highest version for Windows 9* Any
>> tips?
>>
>> Thanks
>>
>>
> Does 'unable to start a 2.5 idle window' mean you get some sort of error
> or simply that nothing happens?
>
Nothing happens and no error message shows. The disk head stepper makes
a brief attempt at something then goes silent and that's it.
> What happens if you simply run C:\Python25\Lib\IDLELIB\idle.bat
> Does that work or not?
>
Same thing: Nothing happens
> What about running this from a command prompt:
>
> C:\Python25\python.exe C:\Python25\Lib\IDLELIB\idle.py
>
Same thing: Nothing!
> Does that run idle or do you get any error messages?
> What about this?
>
> C:\Python25\python.exe C:\Python25\Lib\IDLELIB\idle.pyw
>
>
Nothing!
> Using pythonw.exe will start the program with all error output dumped in
> the bit bucket. Running from a command prompt with python.exe will at
> least let you see if there are any errors.
>
python.exe from the command line works all right in a DOS window. The
problem must be with idle.pyw. I tried the old idle.pyw (2.4) with the
new python.exe. (2.5) and that didn't work either.
What is the bit bucket? If I had a clue, I could go from there. What
puzzles me is that version 2.4 has been working fine and one wouldn't
think that the changes from 2.4 to 2.5 would be so extensive as to cause
a major malfunction. For the time being 2.4 works fine. I'd much prefer
2.5, though, because it includes the image library (PIL), whereas 2.4
cannot even use it.

Frederic


==============================================================================
TOPIC: xmlrpc slow in windows 7 if hostnames are used
http://groups.google.com/group/comp.lang.python/t/e4157a12dd9ece8c?hl=en
==============================================================================

== 1 of 2 ==
Date: Fri, Feb 5 2010 1:10 am
From: News123


Yhanks a lot I'll check whether this is the root cause.

Currently my machine could live without IPV6


bye

N


Gabriel Genellina wrote:
> En Thu, 04 Feb 2010 19:34:20 -0300, News123 <news123@free.fr> escribi�:
>
>> I wrote a small xmlrpc client on Windows 7 with python 2.6
>>
>> srv = xmlrpclib.Server('http://localhost:80')
>>
>> I was able to perform about 1 rpc call per second
>>
>>
>> After changing to
>> srv = xmlrpclib.Server('http://127.0.0.1:80')
>>
>> I was able to perform about 10 to 16 rpc calls per second.
>>
>> So it seems, that under windows 7 the host name lookup occurs for every
>> RPC call
>
> Not necesarily. There is another difference: 127.0.0.1 is an IPv4
> address, localhost maps to both IPv4 and IPv6 addresses (::1)
>
> I vaguely remember a problem with that - IPv6 is tried first, doesn't
> work, only then IPv4, and that slows down the whole process.
> Try disabling completely the IPv6 stack, if you don't need it.
>


== 2 of 2 ==
Date: Fri, Feb 5 2010 2:58 am
From: Jean-Michel Pichavant


News123 wrote:
> Yhanks a lot I'll check whether this is the root cause.
>
> Currently my machine could live without IPV6
>
>
> bye
>
> N
>
>
> Gabriel Genellina wrote:
>
>> En Thu, 04 Feb 2010 19:34:20 -0300, News123 <news123@free.fr> escribió:
>>
>>
>>> I wrote a small xmlrpc client on Windows 7 with python 2.6
>>>
>>> srv = xmlrpclib.Server('http://localhost:80')
>>>
>>> I was able to perform about 1 rpc call per second
>>>
>>>
>>> After changing to
>>> srv = xmlrpclib.Server('http://127.0.0.1:80')
>>>
>>> I was able to perform about 10 to 16 rpc calls per second.
>>>
>>> So it seems, that under windows 7 the host name lookup occurs for every
>>> RPC call
>>>
>> Not necesarily. There is another difference: 127.0.0.1 is an IPv4
>> address, localhost maps to both IPv4 and IPv6 addresses (::1)
>>
>> I vaguely remember a problem with that - IPv6 is tried first, doesn't
>> work, only then IPv4, and that slows down the whole process.
>> Try disabling completely the IPv6 stack, if you don't need it.
>>
>>
Or you can simply use an explicit external address. Most of the time
xmlRPC server/clients are used between distant machines.
If your are using localhost for test purpose, then binding your server
on its external IP instead of the local one could solve your problem
(wihtout removing the IPV6 stack).

import socket

# server
server = SimpleXMLRPCServer((socket.gethostname(), 5000),
logRequests=False, allow_none=True)


# client
xmlrpclib.ServerProxy("http://%s.yourdomain.com:%s" %
(socket.gethostname(), 5000))

JM

PS : please don't top post :o)
PS : just wondering if using the port 80 is legal

==============================================================================
TOPIC: come and join www.pakdub.com where u can find friends, classifieds,
games, music albums, events, blogs, chatrooms, video songs and lot more....
for free
http://groups.google.com/group/comp.lang.python/t/26203e65d2a61cac?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Feb 5 2010 2:24 am
From: babu lohar


come and join www.pakdub.com where u can find friends,
classifieds, games, music albums, events, blogs, chatrooms, video
songs and lot more.... for free

==============================================================================
TOPIC: Python and Ruby
http://groups.google.com/group/comp.lang.python/t/dfe4f6c60032755e?hl=en
==============================================================================

== 1 of 2 ==
Date: Thurs, Feb 4 2010 3:46 pm
From: Ethan Furman


Robert Kern wrote:
> On 2010-02-04 14:55 PM, Jonathan Gardner wrote:
>> On Feb 3, 3:39 pm, Steve Holden<st...@holdenweb.com> wrote:
>>> Robert Kern wrote:
>>>> On 2010-02-03 15:32 PM, Jonathan Gardner wrote:
>>>
>>>>> I can explain all of Python in an hour; I doubt anyone will understand
>>>>> all of Python in an hour.
>>>
>>>> With all respect, talking about a subject without a reasonable
>>>> chance of
>>>> your audience understanding the subject afterwards is not explaining.
>>>> It's just exposition.
>>>
>>> I agree. If the audience doesn't understand then you haven't
>>> explained it.
>>
>> On the contrary, that explanation would have everything you need. It
>> would take an hour to read or listen to the explanation, but much more
>> than that time to truly understand everything that was said.
>
> Like I said, that's exposition, not explanation. There is an important
> distinction between the two words. Simply providing information is not
> explanation. If it takes four hours for your audience to understand it,
> then you explained it in four hours no matter when you stopped talking.
>

And if it takes six months? Would you seriously say it took you six
months to explain something because it took that long for your audience
to understand it?

At some point you have to make the transition from person A explaining
and person(s) B understanding -- they don't necessarily happen
synchronously.

As a real-life example, I've read several Python books, tutorials, and
this list for quite some time, some of which has very good explanatory
material, and yet some of the points I didn't fully comprehend until
much, much later. Every time, though, it's still the same reaction: I
*love* Python! :D

~Ethan~


== 2 of 2 ==
Date: Fri, Feb 5 2010 4:13 am
From: mk


Steve Holden wrote:
>>> Jeez, Steve, you're beginning to sound like some kind of fallacy
>>> zealot... ;)
>> Death to all those who confuse agumentum ad populum with argumentum ad
>> verecundiam!!!
>>
>>
> Yeah, what did the zealots ever do for us?

They produced Python?

.
.
.


Oh Python! Shut up!

==============================================================================
TOPIC: Your beloved python features
http://groups.google.com/group/comp.lang.python/t/599b3c9772421ece?hl=en
==============================================================================

== 1 of 6 ==
Date: Thurs, Feb 4 2010 3:55 pm
From: Ethan Furman


Julian wrote:
> Hello,
>
> I've asked this question at stackoverflow a few weeks ago, and to make
> it clear: this should NOT be a copy of the stackoverflow-thread
> "hidden features of Python".
>
> I want to design a poster for an open source conference, the local
> usergroup will have a table there, and in the past years there were
> some people that came to the python-table just to ask "why should I
> use python?".
>
> For those guys would be a poster quite cool which describes the most
> popular and beloved python features.
>
> So, may you help me please? If there's a similar thread/blogpost/
> whatever, please give it to me, google couldn't.
>
> Regards
> Julian

http://www1.american.edu/academic.depts/cas/econ/faculty/isaac/choose_python.pdf


== 2 of 6 ==
Date: Fri, Feb 5 2010 3:09 am
From: "Martin P. Hellwig"


On 02/04/10 23:03, Julian wrote:
<cut>

> For those guys would be a poster quite cool which describes the most
> popular and beloved python features.

That it is ego-orientated programming ;-)
http://mail.python.org/pipermail/python-announce-list/2009-April/007419.html

--
mph


== 3 of 6 ==
Date: Fri, Feb 5 2010 3:10 am
From: Jean-Michel Pichavant


Ethan Furman wrote:
> Julian wrote:
>> Hello,
>>
>> I've asked this question at stackoverflow a few weeks ago, and to make
>> it clear: this should NOT be a copy of the stackoverflow-thread
>> "hidden features of Python".
>>
>> I want to design a poster for an open source conference, the local
>> usergroup will have a table there, and in the past years there were
>> some people that came to the python-table just to ask "why should I
>> use python?".
>>
>> For those guys would be a poster quite cool which describes the most
>> popular and beloved python features.
>>
>> So, may you help me please? If there's a similar thread/blogpost/
>> whatever, please give it to me, google couldn't.
>>
>> Regards
>> Julian
>
> http://www1.american.edu/academic.depts/cas/econ/faculty/isaac/choose_python.pdf
>
"Choose metaclasses if you don't value your sanity."

That remembers me the time when it took me 4 hours to write a ten lines
metaclass :o)

JM


== 4 of 6 ==
Date: Fri, Feb 5 2010 3:42 am
From: Daniel Fetchinson


>> I've asked this question at stackoverflow a few weeks ago, and to make
>> it clear: this should NOT be a copy of the stackoverflow-thread
>> "hidden features of Python".
>>
>> I want to design a poster for an open source conference, the local
>> usergroup will have a table there, and in the past years there were
>> some people that came to the python-table just to ask "why should I
>> use python?".
>>
>> For those guys would be a poster quite cool which describes the most
>> popular and beloved python features.
>>
>> So, may you help me please? If there's a similar thread/blogpost/
>> whatever, please give it to me, google couldn't.
>>
>> Regards
>> Julian
>
> http://www1.american.edu/academic.depts/cas/econ/faculty/isaac/choose_python.pdf

This is effin hilarious! Should be either linked or stored on python.org

Cheers,
Daniel


--
Psss, psss, put it down! - http://www.cafepress.com/putitdown


== 5 of 6 ==
Date: Fri, Feb 5 2010 4:16 am
From: apeach


I love intuitive type recognition.

no need to 'DIM everything AS Integer' etc.!

== 6 of 6 ==
Date: Fri, Feb 5 2010 4:18 am
From: "bartc"

"R Fritz" <rfritz333@gmail.com> wrote in message
news:e97ff208-d08e-4934-8e38-a40d668cd116@l24g2000prh.googlegroups.com...
> My favorite feature is its readability. It's as near to pseudo-code
> as any language we have, and that's valuable in open source projects
> or when I return to code to modify it.

That might be true when used to code actual algorithms using basic features.

But a lot of Pythonisms would appear mysterious to someone who doesn't know
the language (for example, what does :: mean in an array index).

Or perhaps pseudo-code is much more advanced these days...

--
bartc


==============================================================================
TOPIC: Wrap a function
http://groups.google.com/group/comp.lang.python/t/fce27f8c4a22d12b?hl=en
==============================================================================

== 1 of 1 ==
Date: Thurs, Feb 4 2010 10:42 pm
From: Dennis Lee Bieber


On 4 Feb 2010 16:18:04 -0800, aahz@pythoncraft.com (Aahz) declaimed the
following in gmane.comp.python.general:

>
> But in bash scripting, you'd just use rsync or cp or rm -- maybe an
> example would make clearer how REXX differs from bash.

I suspect the only really good examples would have to written under
OS/VMS (where it originated, written to be a more powerful & friendlier
replacement for the EXEC scripting language) or AmigaOS -- to
demonstrate the switching interaction of command handlers. REXX
implementations for Windows and Linux pretty much only support the
"shell" as a command handler, whereas the two named OS could address
editors (and on the Amiga, word processors, desktop publishing programs,
terminal emulators/comm programs, system editor).

My Amiga's been in storage since Win95 days, so this is a fictitious
example based on the reference manuals.

address command /* use normal command shell to process commands */
file = 'some.file'
'run ed' file /* start ED editor in background, editing 'file'*/
address ED /* send commands to the ED instance */
'b' /* go to bottom of file */
'i /text to be inserted before bottom line/'
't' /* to to top */
'a /text inserted after first line/'
find = 'needle'
replace = 'thorn'
'rpe /' || find || '/' || replace '/'
'x' /* save & exit */
address command
'type' file /* type file to screen */
'filenote' file "edited via AREXX script"

--
Wulfraed Dennis Lee Bieber KD6MOG
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/


==============================================================================
TOPIC: Building a multiline string
http://groups.google.com/group/comp.lang.python/t/cb131609c7b065a9?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Feb 5 2010 3:11 am
From: lallous


@Ulrich:

On Feb 4, 1:09 pm, Ulrich Eckhardt <eckha...@satorlaser.com> wrote:
> Just for the record: Neither of the below methods actually produce a
> multiline string. They only spread a string containing one line over
> multiple lines of source code.
>

I meant:
"Note" -> "Note: I don't want to use new lines"

I did not want a multi line string


Thanks guys, method 3 seems to be good enough.

==============================================================================
TOPIC: Employee motivation in the software industry
http://groups.google.com/group/comp.lang.python/t/ade12a9b8f5f2122?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Feb 5 2010 3:22 am
From: Stefan Kiryazov


Hi all,

I am doing a research about motivation in software development, the
most efficient practices to motivate software engineers, their
popularity, etc.

As a part of the research, I am doing an online survey for software
engineers and managers in software development. It takes just several
minutes and filling it is a good opportunity to share your opinion
about the motivation practices being used in the software industry
today:
http://ask.wizefish.com/en/MotivationSurvey.aspx

Anyone who does the survey and leaves any contacts will be sent the
results.

Also, if someone is running a web site or blog dedicated to any aspect
of software development we can do some link exchange.

Regards,
Stefan Kiryazov

==============================================================================
TOPIC: Repost: Read a running process output
http://groups.google.com/group/comp.lang.python/t/195cc1de992e13b3?hl=en
==============================================================================

== 1 of 5 ==
Date: Fri, Feb 5 2010 3:57 am
From: Ashok Prabhu


Hi,

I very badly need this to work. I have been googling out for a week
with no significant solution. I open a process p1 which does keeps
running for 4+ hours. It gives some output in stdout now and then. I
open this process with subprocess.Popen and redirect the stdout to
PIPE. However when I read the output with readline it blocks waiting
forever. I need to read from p1.stdout till what it has in the PIPE.
Can someone help me out with the exact code change that can accomplish
the task.

from subprocess import *

p1=Popen('/usr/sunvts/bin/64/vtsk -d',stdout=PIPE,shell=True)

while 1:
line=p1.stdout.readline()
print line

Thanks in advance,
~Ashok.


== 2 of 5 ==
Date: Fri, Feb 5 2010 4:12 am
From: Alain Ketterlin


Ashok Prabhu <ashokprabhuv@gmail.com> writes:

> from subprocess import *
> p1=Popen('/usr/sunvts/bin/64/vtsk -d',stdout=PIPE,shell=True)

Use Popen(['/usr/...','-d'],stdout=PIPE), i.e., no shell.

-- Alain.


== 3 of 5 ==
Date: Fri, Feb 5 2010 4:53 am
From: Ashok Prabhu


On Feb 5, 5:12 pm, Alain Ketterlin <al...@dpt-info.u-strasbg.fr>
wrote:
> Ashok Prabhu <ashokprab...@gmail.com> writes:
> > from subprocess import *
> > p1=Popen('/usr/sunvts/bin/64/vtsk -d',stdout=PIPE,shell=True)
>
> Use Popen(['/usr/...','-d'],stdout=PIPE), i.e., no shell.
>
> -- Alain.

Hi Alain,

Thanks for the response. However it throws an error. Please find
below.

>>> from subprocess import *
>>> p1=Popen('/usr/sunvts/bin/64/vtsk -d',stdout=PIPE)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.4/subprocess.py", line 543, in __init__
errread, errwrite)
File "/usr/lib/python2.4/subprocess.py", line 975, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory

Thanks,
~Ashok.


== 4 of 5 ==
Date: Fri, Feb 5 2010 4:58 am
From: Alain Ketterlin


Ashok Prabhu <ashokprabhuv@gmail.com> writes:

>> > p1=Popen('/usr/sunvts/bin/64/vtsk -d',stdout=PIPE,shell=True)
>>
>> Use Popen(['/usr/...','-d'],stdout=PIPE), i.e., no shell.
>>
>> -- Alain.

> Thanks for the response. However it throws an error. Please find
> below.
>
>>>> from subprocess import *
>>>> p1=Popen('/usr/sunvts/bin/64/vtsk -d',stdout=PIPE)

You forgot to change the monolithic command into a list of words. Since
you don't use the shell anymore you have to give Popen a pre-parsed
command line.

-- Alain.


== 5 of 5 ==
Date: Fri, Feb 5 2010 5:33 am
From: Ashok Prabhu


On Feb 5, 5:58 pm, Alain Ketterlin <al...@dpt-info.u-strasbg.fr>
wrote:
> Ashok Prabhu <ashokprab...@gmail.com> writes:
> >> > p1=Popen('/usr/sunvts/bin/64/vtsk -d',stdout=PIPE,shell=True)
>
> >> Use Popen(['/usr/...','-d'],stdout=PIPE), i.e., no shell.
>
> >> -- Alain.
> > Thanks for the response. However it throws an error. Please find
> > below.
>
> >>>> from subprocess import *
> >>>> p1=Popen('/usr/sunvts/bin/64/vtsk -d',stdout=PIPE)
>
> You forgot to change the monolithic command into a list of words. Since
> you don't use the shell anymore you have to give Popen a pre-parsed
> command line.
>
> -- Alain.

Here is the error again

>>> p1=Popen('/usr/sunvts/bin/64/vtsk','-d',stdout=PIPE)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.4/subprocess.py", line 494, in __init__
raise TypeError("bufsize must be an integer")
TypeError: bufsize must be an integer


~Ashok.

==============================================================================
TOPIC: Simple question about Queue.Queue and threads
http://groups.google.com/group/comp.lang.python/t/032256dd608c9c02?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Feb 5 2010 4:45 am
From: "Frank Millman"


Hi all

Assume you have a server process running, a pool of worker threads to
perform tasks, and a Queue.Queue() to pass the tasks to the workers.

In order to shut down the server cleanly, you want to ensure that the
workers have all finished their tasks. I like the technique of putting a
None onto the queue, and have each worker check for None, put None back onto
the queue, and terminate itself.

The main program would look something like this -

q.put(None)
for worker in worker_threads:
worker.join()

At this point you can be sure that each thread has completed its 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


==============================================================================

You received this message because you are subscribed to the Google Groups "comp.lang.python"
group.

To post to this group, visit http://groups.google.com/group/comp.lang.python?hl=en

To unsubscribe from this group, send email to comp.lang.python+unsubscribe@googlegroups.com

To change the way you get mail from this group, visit:
http://groups.google.com/group/comp.lang.python/subscribe?hl=en

To report abuse, send email explaining the problem to abuse@googlegroups.com

==============================================================================
Google Groups: http://groups.google.com/?hl=en

No comments:

Post a Comment