--------------------------------------------------
From: "Frédéric Mantegazza" <[EMAIL PROTECTED]>
Sent: Tuesday, April 08, 2008 5:48 AM
To: <pythonce@python.org>
Subject: [PythonCE] win32api

> Does the win32api exist for PythonCE? I'm trying to write code that can
> work under linux, win and winCE. linux and win works fine, using this
> code:
>
> if sys.platform.startswith("linux") or sys.platform.startswith("Mac"):
>    HOME_DIR = os.path.expandvars("$HOME")
>    CONFIG_DIR = os.path.join(HOME_DIR, ".papywizard")
>    try:
>        os.mkdir(CONFIG_DIR)
>    except OSError, (errno, errmsg):
>        if errno == 17:
>            pass
>        else:
>            raise
>    TEMP_DIR = "/tmp"
> elif sys.platform.startswith("win"):
>    import win32api
>    HOME_DIR = win32api.ExpandEnvironmentStrings("%HOMEPATH%")
>    CONFIG_DIR = os.path.join(HOME_DIR, ".papywizard")
>    try:
>        os.mkdir(CONFIG_DIR)
>    except OSError, (errno, errmsg):
>        if errno == 183:
>            pass
>        else:
>            raise
>    TEMP_DIR = CONFIG_DIR
>
> How can I add support for winCE?
>
> Thanks,
>
> -- 
>   Frédéric

Hi,

Generally speaking, if I were you I would avoid pywin32 and use ctypes for 
accessing the Win32 API, because it is included in both Python 2.5 and 
PythonCE 2.5. You would still need to handle differences between Windows and 
Windows CE though, e.g. Unicode vs ANSI, kernel32 vs coredll, etc.

However, in this specific case that will not solve the problem because 
Windows CE does not have any concept of environment variables, multiple 
users or home directories.

Luke
 

_______________________________________________
PythonCE mailing list
PythonCE@python.org
http://mail.python.org/mailman/listinfo/pythonce

Reply via email to