easy problems, hard to fix?

Gerhard Häring gh at ghaering.de
Fri May 9 05:08:30 EDT 2003


Oh man. This thread still continues?

Ok, let me explain.

Bunger wrote:
> I'm wondering what is wrong with this code.  I use this program in
> windows.  I suspect that I don't have sys from "import sys" on my
> computer.

Why do you expect this?

> Is this the problem?

No. sys is a builtin module that every Python has, even if you delete 
the Lib directory.

> and how can I fix it?  This program is
> transelated from linux.  Please help me.
> 
> 
> this is the error messeges I get:
> [...]
>     execPip.wait()
> AttributeError: 'tuple' object has no attribute 'wait'

You have a name 'execPip' refer to an object.

On this object, you try to get the object with the attribute name 'wait' 
and call it. This doesn't work, because the object in question doesn't 
have an attribute 'wait'.

> 	execPip = popen2.popen3(execStr)

In the Linux version you've called .Popen3(), didn't you. Now, we have

popen2.popen3
popen2.Popen3

are *different* things. Case matters! Read the docs for details.

The short version is that win32 Python doesn't have popen2.Popen3, so 
your code won't work on win32 :-( There might be a win32-specific 
solution using the win32api module from the win32 extensions, though.

Or maybe it's time to implement popen2.Popen3 for Windows?

> 	execPip.wait()

insert a "print execPip, type(execPip)" before that line to see why it 
can't work.

Sorry for the bad news.

HTH & HAND,

-- Gerhard





More information about the Python-list mailing list