[PythonCE] Server socket + MessageBox hangs ?
Olivier Fambon
Olivier.Fambon@xrce.xerox.com
Fri, 29 Nov 2002 18:25:29 +0100
> Telion [Fri, 29 Nov 2002 08:58:19 -0800 (PST)] wrote:
>
>> If you are running "PythonCE2.2+ for HPC2000" on your iPaq (which is PPC),
>> win32gui module may cause some problems.
>
> Ah ahhhh. Might be why then.
Could it also be the cause for a bad listdir implem ?
On my iPaq, using listdir on an empty dir raises an exception instead
of returning [].
So I patched the [already patched] listdir with this:
import os
os.__listdir = os.listdir
def __listdirfix(p):
if p != '' : p = os.path.abspath(p)
if p == "\\": p = ''
if not os.stat(p)[0] & 0x4000: # stat raises Errno 18 [no file]
raise os.error, "Not a dir: '%s'" % p
try:
return os.__listdir(p)
except:
return []
os.listdir = __listdirfix