Re: Quality control in open source development

2008-10-08 Thread Samuel A. Falvo II
On Oct 8, 8:43 am, Dave [EMAIL PROTECTED] wrote:
 With the open source licenses that allow redistribution of modified
 code, how do you keep someone unaffiliated with the Python community
 from creating his or her own version of python, and declaring it to be
 Python 2.6, or maybe Python 2.7 without any approval of anyone at the
 PSF? Maybe their code is terrible, and not even compatible with the
 rest of Python! How can the PSF, for example, maintain the quality and
 coheren of new code contributed to be part of Python, or derivative
 works that claim to be some future version of Python? If licensees can
 redisribute as they like, isn't this a huge problem? Is this dealt
 with be restricting use of the Python trademarks?  Just curious..

Most trademark violations have occurred, to the best of my
recollection, by commercial entities trying to usurp the popularity of
an open-source endeavor for their own commercial gain.  It is very
rare that another in the open-source community will commandeer the
good name of another project for his own purposes.

This gives strong credence to the idea that the highly participatory
nature of the open-source community serves as a strong, self-enforcing
deterrent to negative acts of this nature.

As far as quality assurance itself goes, independent, third-party unit
test suites are easily engineered.  Parties who do manage to succeed
in releasing their own Python 2.7 can do so only by either making
their product compatible with this third-party verification suite, or
by not doing so.  This leads to two situations:

(1) If compatible, then the name Python 2.7 may well be accepted by
the community, even if only in an allegorical sense (e.g., If PSF
released Python 2.7, this product is how I envision it'd be like.).
Alternatively, people will recognize the product as being Python-
compatible, but otherwise an independent line of development -- e.g.,
a fork.  The PSF can then release under a new set of version numbers
(where everyone understands that 2.7 is an independent fork not
endorsed by PSF), persue negotiations (ultimately terminating in legal
action) to arrive at an acceptable product name, etc.  If the PSF were
feeling particularly benevolent, they could even accept some ideas
from the 2.7 release into their own branch of development.

(2) If incompatible, the product will gather a reputation of
inferiority rapidly, and those clearly interested in Python will
neither want nor have anything to do with this misbranded malfeasance.

Again, independent verification is an example of the participatory
nature of the community at large, and is a prime example of how
concerned citizens can act collectively in their own interest,
independently, to help ensure the quality of a socially-accepted
product.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Using subprocess module to launch a shell shell script that itself forks a process

2008-10-08 Thread Samuel A. Falvo II
On Oct 7, 6:23 pm, Gabriel Genellina [EMAIL PROTECTED] wrote:
 Is your shell script doing something else, apart from invoking the java  
 process?

Obviously, yes.  The script is some 150 lines long.  But the hang-up
occurs because of the forked Java process, not the other lines.

 If not, you could just invoke java directly from Python. Also,  
 you set stdin=PIPE - is your java process expecting some input? you're not  
 writing anything to stdin.

It does not expect input from stdin.  However, this does not affect
any OTHER scripts or commands I run.

Let's remember to look at the objective facts: for shell scripts that
launch child processes of their own, Python hangs.  For all other
types of commands, it works 100% as expected.

 Anyway, it's better to use the communicate method instead (it uses select  
 to read from both stdout and stderr):

That doesn't help me.

 See  http://docs.python.org/library/subprocess.html#subprocess.Popen.commu...

I have.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Using subprocess module to launch a shell shell script that itself forks a process

2008-10-08 Thread Samuel A. Falvo II
On Oct 8, 11:31 am, Samuel A. Falvo II [EMAIL PROTECTED] wrote:
 I removed the stdin=PIPE argument, and this works.  Many thanks for
 bringing this to my attention.

OK, I am confused.  After observing a bug where the code works every
other time, like clockwork, I've used strace to figure out what is
going on.  In the times when it works, it's only the shell script
complaining that it's already running.

So, I'm right back to square one.  Even _without_ setting stdin=PIPE,
it fails to unblock.  I'm left utterly bewildered.

The only thing I can think of is that the JVM's stdout is tied to the
shell script's stdout, because that's the only way it can remain open
upon the termination of the child process.  I suppose, at this point,
the next place to look is in shell script syntax to find out how to
detach the JVM from the script's process group.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Using subprocess module to launch a shell shell script that itself forks a process

2008-10-08 Thread Samuel A. Falvo II
On Oct 8, 11:24 am, Samuel A. Falvo II [EMAIL PROTECTED] wrote:
 It does not expect input from stdin.  However, this does not affect
 any OTHER scripts or commands I run.

OK, so, I'm very confused as to why this would matter.

I removed the stdin=PIPE argument, and this works.  Many thanks for
bringing this to my attention.

But, my question now is, WHY is this an issue?  If the launched
process doesn't read from its stdin, why would it block?  Hence my
question here:

 Let's remember to look at the objective facts: for shell scripts that
 launch child processes of their own, Python hangs.  For all other
 types of commands, it works 100% as expected.

Meaning, if I launched the Java process directly, it works fine.  If I
launch it from the shell script WITHOUT background execution, it works
fine.  But when I launch it WITH background execution (e.g., with the
 suffix), then it blocks.

Any ideas, so I can write this into my log for future reference?

Thanks.

--
http://mail.python.org/mailman/listinfo/python-list


Using subprocess module to launch a shell shell script that itself forks a process

2008-10-07 Thread Samuel A. Falvo II
I have a shell script script.sh that launches a Java process in the
background using the -operator, like so:

 #!/bin/bash
 java ... arguments here ... 

In my Python code, I want to invoke this shell script using the
Subprocess module.  Here is my code:

def resultFromRunning_(command):
Invokes a shell command, and returns the stdout response.

Args:
command: A string containing the complete shell command to
run.

Results:
A string containing the output of the command executed.

Raises:
ValueError if a non-zero return code is returned from the
shell.
OSError if command isn't found, inappropriate permissions,
etc.


L = log4py.Logger().get_instance()
L.info(Executing:  + command)

p = subprocess.Popen(
command,
shell=True,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
close_fds=True
)

outputChannel = p.stdout
output = outputChannel.read()

result = p.wait()
if result:
raise(ShellError(command, result, output))

L.info(Result =  + str(output))
return output

When running the aforementioned code, it kicks off the shell script,
and, the shell script kicks off the Java process.  However, the Python
code never returns from outputChannel.read() until I explicitly kill
the Java process myself via the kill shell command.

I've researched this issue on Google and various other websites, and
maybe I'm missing the obvious, but I cannot seem to find any
documentation relevant to this problem.  Lots of references to bugs
filed in the past, that appear to be fixed, or to websites talking
about how the Popen module has a 64K limit on its data queue size, but
nothing relevent to my situation.

Can anyone inform me or point me to the appropriate documentation on
how to properly invoke a shell command such that any spawned children
processes don't cause Python to hang on me?  I assume it has something
to do with process groups, but I'm largely ignorant of how to control
those.

Thanks in advance.
--
http://mail.python.org/mailman/listinfo/python-list