Michael Foord wrote:

I found an archived email with osce.py at : http://mail.python.org/pipermail/pythonce/2002-October/000246.html


Please ignore the proxy url here - you won't be able to use it anyway. The proper address is just :
http://mail.python.org/pipermail/pythonce/2002-October/000246.html


This contains examples of how to use the module, so worth looking up. It is over 2 years old though... so caveat emptor.

Regards,

Fuzzy
http://www.voidspace.org.uk/python/index.shtml

<https://www.bandos.homelinux.com/cgi-bin/pytest/approx.py/http/mail.python.org/pipermail/pythonce/2002-October/000246.html>


I used the base64 encoding to extract the plaintext of the attachment. I haven't tested to see if it works - looks interesting though.


Regards,

Fuzzy
http://www.voidspace.org.uk/python/index.shtml

Isr Gish wrote:

There is a module osce.py floating around that emulates the system functions. It was created by Telion.

All the best,
Isr

-----Original Message-----
>From: "Brad Clements"<[EMAIL PROTECTED]>
>Sent: 1/14/05 10:02:16 AM
>To: "Geir Egeland"<[EMAIL PROTECTED]>, "pythonce@python.org"<pythonce@python.org>
>Subject: Re: [PythonCE] launch external application from pythonCE
>On 14 Jan 2005 at 13:25, Geir Egeland wrote:
>
>> So, this doesn't seem to work...
>> Doing a help(os) does not show the 'system' command under available >> functions.
>> Any other suggestions?
>
>
>I don't think system exists on windows CE.
>
>Hmm, even the 4.20 .NET reference doesn't show _exec or _spawn as being >supported in libc.
>
>You'll have to use CreateProcess() from win32api I suppose.
>
>
>
>
>-- >Brad Clements, [EMAIL PROTECTED] (315)268-1000
>http://www.murkworks.com (315)268-9812 Fax
>http://www.wecanstopspam.org/ AOL-IM: BKClements
>
>_______________________________________________
>PythonCE mailing list
>PythonCE@python.org
>http://mail.python.org/mailman/listinfo/pythonce
>


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






------------------------------------------------------------------------

# Module osce.py

# This file is read and integrated by os.py

# Call these funcs from os

#

# Telion



# CE patch for execv etc..



#import win32process

#import string

#import win32event



def execv (path, args):

        import os

        if not type(args) in (tuple, list):

                raise TypeError, "execv() arg 2 must be a tuple or list"

        p=os.path.abspath(path)

        #if os.path.exists(p):

        import win32process

        import string

        hPro,hThr,dwPro,dwThr=win32process.CreateProcess(p,string.join(args,' 
'),None,None,0,0,None,None,None)

        #del string

        #del win32process

        #del os



def execve (path, args, env):

        # Currently, env is simply ignored. Sorry if you were trying to use 
that.

        import os

        if not type(args) in (tuple, list):

                raise TypeError, "execve() arg 2 must be a tuple or list"

        p=os.path.abspath(path)

        import win32process

        import string

        hPro,hThr,dwPro,dwThr=win32process.CreateProcess(p,string.join(args,' 
'),None,None,0,0,env,None,None)

        #del string

        #del win32process

        #del os





def system(cmd):

        # This function will not start program in the directory with space(s)

        # It is the same for other Windows version of Python.

        # I made os.sytema(cmd, arg) for your convenience.

        # Note: the retrun value maybe unliable...



        import win32process

        import string

        import os

        import win32event

        #import re

        a = string.find(cmd, ' ')

        arg = ''

        if a >0:

                p=cmd[:a]

                arg = cmd[a+1:]

        else:

                p=cmd

        p=os.path.abspath(p)

        
hPro,hThr,dwPro,dwThr=win32process.CreateProcess(p,arg,None,None,0,0,None,None,None)

        if hPro and hThr:

                win32event.WaitForSingleObject(hPro,win32event.INFINITE)

                r = win32process.GetExitCodeProcess(hPro) # This returns always 
0?

                #r2 = win32process.GetExitCodeThread(hThr)

        #del re

        #del string

        #del win32process

        #del win32event

        #del os

        return r



def systema(cmd,arg):

        # This function is for CE only...

        #

        import win32process

        import string

        import os

        import win32event

        #import re

        p=os.path.abspath(cmd)

        
hPro,hThr,dwPro,dwThr=win32process.CreateProcess(p,arg,None,None,0,0,None,None,None)

        if hPro and hThr:

                win32event.WaitForSingleObject(hPro,win32event.INFINITE)

r = win32process.GetExitCodeProcess(hPro)

        #del re

        #del string

        #del win32process

        #del win32event

        #del os

        return r







def syscmd(icmd, wait=0):

        # call up a command through CMD.EXE and let it stay open after 
executeion

        # Python does not wait for the command uness "wait" is True.

        import win32process

        import win32event

        hPro,hThr,dwPro,dwThr=win32process.CreateProcess('\\windows\\cmd','/k 
'+icmd,None,None,0,0,None,None,None)

        if wait and hPro and hThr:

                win32event.WaitForSingleObject(hPro,win32event.INFINITE)

        #del win32event

        #del win32process





def syscmdc(icmd, wait=0):

        # call up a command through CMD.EXE and close it after return

        # Python does not wait for the command uness "wait" is True.

        import win32process

        import win32event

        hPro,hThr,dwPro,dwThr=win32process.CreateProcess('\\windows\\cmd','/c 
'+icmd,None,None,0,0,None,None,None)

        if wait and hPro and hThr:

                win32event.WaitForSingleObject(hPro,win32event.INFINITE)

        #del win32event

        #del win32process





------------------------------------------------------------------------

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



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

Reply via email to