Question: I have written my own module, mainly handling a filefield for a django site. After messing around with some things related to mod\_wsgi (solved by updating to 3.3), i got my code to run. Right after all the necessary imports, before defining any classes or functions, i test for the availability of sox, an audiocommandlinetool essential to some of my modules functions:

```
sox = 'path/to/sox'
test=subprocess.Popen([sox,'-h'], shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
error=test.communicate()[1]
if error:
    raise EnvironmentError((1,'Sox not installed properly'),)

```

This worked fine. Now i have updated ubuntu from 8.04 to 10.04 and the code aborts on the line of the call to subprocess.Popen, throwing the following error message:

```
File "/usr/lib/python2.6/subprocess.py", line 1139, in _execute_child
    raise child_exception
OSError: [Errno 8] Exec format error  

```

I already looked for execution rights of sox, i have no other idea where to look for a solution of this. Can subprocess execution rights be limited? Any hints what could be going on here?

Answer: 
Your logic is flawed:

if your variable `strExt` was equal to `'wav'` it would *not* be equal to `'mp3'`, and versa-visa.

Please explain your desired results more clearly.

I think what you're trying to say is something like (neither `'wav'` *nor* `'mp3'`):

```
if ( !( strExt == 'wav' || strExt == 'mp3' ) )

```

which is logically equivalent to (not `'wav'` *and not* `'mp3'`):

```
if ( strExt != 'wav' && strExt != 'mp3' ) )

```
`||` says: if any condition is true, It'll return true, without looking at the ones after it.

So `true || false` is true, `false || true` is true.

In your case, you say "if strExt is not equal to **wav** and is not equal to **mp3**, then execute the code". In case that one of them is true, it executes.

I'm thinking that you're looking for the `&&` symbol. The `logical and` says "I'll return true only if every condition is true" - when it hits a false, it returns false.

What I think your code should look like:

```
if (strExt!='wav' && strExt!='mp3')

```