[PythonCE] exec* Funcs

Telion telionce@yahoo.com
Mon, 21 Oct 2002 13:42:26 -0700 (PDT)


--0-323568573-1035232946=:71914
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

--- goodey27@juno.com wrote:
> When using exec* functions the documentation states to put the name of
> the func.
> used as argument to args list. But when using it on Win CE with Telion's
> osce module, 'DON'T' do that.
> Just put the parameters you want to send to the program.

Although it is not real execv at all, the way you should give
arguments is the same.

What are the examples you tried?

> 
> Telion: 
> 1) Is there a way on WinCE to have Python wait till the other program
> returns?

Actually, execv* should not wait.
They are supposed to invoke other process, 
and let python die at that moment.

Current execv imitation is acting more like spawn(), I guess.

If you want Python to wait, use os.system.

If os.system is giving you problem because of spaces in the pathname,
use "os.systema" contained in updated osce.py attached on this mail.
(I made that function because os.system does not handle pathnames with
spaces in it. And it is the same on desktop Python... )

>>> os.systema('windows/cmd','/k dir *.txt') # invoke command console of HPC
>>> os.systema('/program files/zzz/yyy.exe','arg1 arg2 arg3') # invoke what
ever you want


> 2) Is there a way to have a script run, by double tapping, even when
> Python is already running.

That may not be possible with the distribution you have.
I think Brad has changed the code so that only one copy of 
Python should run, when he updated (Pythoncore4.zip).

So, either you can use older python22.dll that may not contain _socket,
or you can try to use HPC2000 distribution with PPC specific files from
the distribution Brad has made (Pocket PC Python.exe, win32gui, pcceshell.py).

Later this week or next week, 
I will make trial Cab distribution with above configuration.

Now, I'm working so that command line parameter can be used.
Someone has sent me a patch for it, and I'm compiling and testing.
When I finish that and some other stuffs I wanted to improve,
I'll make new release for HPC2000, and trial distribution for PPC.

New release will include;

  improved pcceshell.py with clear screen, command logging, 
  simple command history,
  slightly better imitation for os.system and os.execv,
  multi-byte pathname, filename support for os.listdir, os.mkdir, etc.
  and commandline parameter support.

Most probably, PPC trial distribution will be able to run 
multiple copy of Python.




=====
Telion
- telionce@yahoo.com -
http://pages.ccapcable.com/lac/PythonCE.html

__________________________________________________
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
http://webhosting.yahoo.com/
--0-323568573-1035232946=:71914
Content-Type: application/octet-stream; name="osce.py"
Content-Transfer-Encoding: base64
Content-Description: osce.py
Content-Disposition: attachment; filename="osce.py"

IyBNb2R1bGUgb3NjZS5weQ0KIyBUaGlzIGZpbGUgaXMgcmVhZCBhbmQgaW50
ZWdyYXRlZCBieSBvcy5weQ0KIyBDYWxsIHRoZXNlIGZ1bmNzIGZyb20gb3MN
CiMNCiMgVGVsaW9uDQoNCiMgQ0UgcGF0Y2ggZm9yIGV4ZWN2IGV0Yy4uDQoN
CiNpbXBvcnQgd2luMzJwcm9jZXNzDQojaW1wb3J0IHN0cmluZw0KI2ltcG9y
dCB3aW4zMmV2ZW50DQoNCmRlZiBleGVjdiAocGF0aCwgYXJncyk6DQoJaW1w
b3J0IG9zDQoJaWYgbm90IHR5cGUoYXJncykgaW4gKHR1cGxlLCBsaXN0KToN
CgkJcmFpc2UgVHlwZUVycm9yLCAiZXhlY3YoKSBhcmcgMiBtdXN0IGJlIGEg
dHVwbGUgb3IgbGlzdCINCglwPW9zLnBhdGguYWJzcGF0aChwYXRoKQ0KCSNp
ZiBvcy5wYXRoLmV4aXN0cyhwKToNCglpbXBvcnQgd2luMzJwcm9jZXNzDQoJ
aW1wb3J0IHN0cmluZw0KCWhQcm8saFRocixkd1Bybyxkd1Rocj13aW4zMnBy
b2Nlc3MuQ3JlYXRlUHJvY2VzcyhwLHN0cmluZy5qb2luKGFyZ3MsJyAnKSxO
b25lLE5vbmUsMCwwLE5vbmUsTm9uZSxOb25lKQ0KCSNkZWwgc3RyaW5nDQoJ
I2RlbCB3aW4zMnByb2Nlc3MNCgkjZGVsIG9zDQoNCmRlZiBleGVjdmUgKHBh
dGgsIGFyZ3MsIGVudik6DQoJIyBDdXJyZW50bHksIGVudiBpcyBzaW1wbHkg
aWdub3JlZC4gU29ycnkgaWYgeW91IHdlcmUgdHJ5aW5nIHRvIHVzZSB0aGF0
Lg0KCWltcG9ydCBvcw0KCWlmIG5vdCB0eXBlKGFy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